diff options
author | dillon <dillon@FreeBSD.org> | 1999-02-12 09:51:43 +0000 |
---|---|---|
committer | dillon <dillon@FreeBSD.org> | 1999-02-12 09:51:43 +0000 |
commit | e38d19126b1d9c854c2d84785f6a15b2770fde83 (patch) | |
tree | 9eac3e8e3f738df866a250bb544495c61cb1e07c /sys/vm/vm_object.c | |
parent | 22876d91387e8dfd0214a5d6be980a2bbcc8523d (diff) | |
download | FreeBSD-src-e38d19126b1d9c854c2d84785f6a15b2770fde83.zip FreeBSD-src-e38d19126b1d9c854c2d84785f6a15b2770fde83.tar.gz |
Fix non-fatal bug in vm_map_insert() which improperly cleared
OBJ_ONEMAPPING in the case where an object is extended by an
additional vm_map_entry must be allocated.
In vm_object_madvise(), remove calll to vm_page_cache() in MADV_FREE
case in order to avoid a page fault on page reuse. However, we still
mark the page as clean and destroy any swap backing store.
Submitted by: Alan Cox <alc@cs.rice.edu>
Diffstat (limited to 'sys/vm/vm_object.c')
-rw-r--r-- | sys/vm/vm_object.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index bb95ec2..250f727 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -61,7 +61,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_object.c,v 1.147 1999/02/08 05:15:54 dillon Exp $ + * $Id: vm_object.c,v 1.148 1999/02/08 19:00:15 dillon Exp $ */ /* @@ -762,8 +762,8 @@ vm_object_madvise(object, pindex, count, advise) end = pindex + count; /* - * MADV_FREE special case - free any swap backing store (as well - * as resident pages later on). + * MADV_FREE special case - free any swap backing store now, + * whether or not resident pages can be found later. */ if (advise == MADV_FREE) { @@ -835,24 +835,18 @@ shadowlookup: vm_page_deactivate(m); } else if (advise == MADV_FREE) { /* - * If MADV_FREE_FORCE_FREE is defined, we attempt to - * immediately free the page. Otherwise we just - * destroy any swap backing store, mark it clean, - * and stuff it into the cache. + * Mark the page clean. This will allow the page + * to be freed up by the system. However, such pages + * are often reused quickly by malloc()/free() + * so we do not do anything that would cause + * a page fault if we can help it. + * + * Specifically, we do not try to actually free + * the page now nor do we try to put it in the + * cache (which would cause a page fault on reuse). */ pmap_clear_modify(VM_PAGE_TO_PHYS(m)); m->dirty = 0; - -#ifdef MADV_FREE_FORCE_FREE - if (tobject->resident_page_count > 1) { - vm_page_busy(m); - vm_page_protect(m, VM_PROT_NONE); - vm_page_free(m); - } else -#endif - { - vm_page_cache(m); - } } } } |