diff options
author | alc <alc@FreeBSD.org> | 2013-06-10 01:48:21 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2013-06-10 01:48:21 +0000 |
commit | 53ffec3a56d5ab2cc946cc172c6d2ee82170f189 (patch) | |
tree | f2a0c8780bba045aedb1ca3a44f475c8509be627 /sys/vm/vm_object.c | |
parent | ac0545a5fe5499c5778d468bbe69f9267b5cfeec (diff) | |
download | FreeBSD-src-53ffec3a56d5ab2cc946cc172c6d2ee82170f189.zip FreeBSD-src-53ffec3a56d5ab2cc946cc172c6d2ee82170f189.tar.gz |
Revise the interface between vm_object_madvise() and vm_page_dontneed() so
that pointless calls to pmap_is_modified() can be easily avoided when
performing madvise(..., MADV_FREE).
Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'sys/vm/vm_object.c')
-rw-r--r-- | sys/vm/vm_object.c | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 9ddd141..97d8557 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -1175,28 +1175,8 @@ shadowlookup: } if (advise == MADV_WILLNEED) { vm_page_activate(m); - } else if (advise == MADV_DONTNEED) { - vm_page_dontneed(m); - } else if (advise == MADV_FREE) { - /* - * 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). - * - * But we do make the page is freeable as we - * can without actually taking the step of unmapping - * it. - */ - pmap_clear_modify(m); - m->dirty = 0; - m->act_count = 0; - vm_page_dontneed(m); + } else { + vm_page_advise(m, advise); } vm_page_unlock(m); if (advise == MADV_FREE && tobject->type == OBJT_SWAP) |