summaryrefslogtreecommitdiffstats
path: root/sys/vm/pmap.h
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2007-11-17 22:52:29 +0000
committeralc <alc@FreeBSD.org>2007-11-17 22:52:29 +0000
commitd1ab859bdce52e381ae74e98a1e951e839b6726f (patch)
tree8c219244ed89f7561e53ea8b24266c64a0c5d008 /sys/vm/pmap.h
parent4e6e975846d9ebf395f824bc88086133d51086b1 (diff)
downloadFreeBSD-src-d1ab859bdce52e381ae74e98a1e951e839b6726f.zip
FreeBSD-src-d1ab859bdce52e381ae74e98a1e951e839b6726f.tar.gz
Prevent the leakage of wired pages in the following circumstances:
First, a file is mmap(2)ed and then mlock(2)ed. Later, it is truncated. Under "normal" circumstances, i.e., when the file is not mlock(2)ed, the pages beyond the EOF are unmapped and freed. However, when the file is mlock(2)ed, the pages beyond the EOF are unmapped but not freed because they have a non-zero wire count. This can be a mistake. Specifically, it is a mistake if the sole reason why the pages are wired is because of wired, managed mappings. Previously, unmapping the pages destroys these wired, managed mappings, but does not reduce the pages' wire count. Consequently, when the file is unmapped, the pages are not unwired because the wired mapping has been destroyed. Moreover, when the vm object is finally destroyed, the pages are leaked because they are still wired. The fix is to reduce the pages' wired count by the number of wired, managed mappings destroyed. To do this, I introduce a new pmap function pmap_page_wired_mappings() that returns the number of managed mappings to the given physical page that are wired, and I use this function in vm_object_page_remove(). Reviewed by: tegge MFC after: 6 weeks
Diffstat (limited to 'sys/vm/pmap.h')
-rw-r--r--sys/vm/pmap.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/vm/pmap.h b/sys/vm/pmap.h
index 3d9045f..61c5fa6 100644
--- a/sys/vm/pmap.h
+++ b/sys/vm/pmap.h
@@ -114,6 +114,7 @@ void pmap_object_init_pt(pmap_t pmap, vm_offset_t addr,
vm_object_t object, vm_pindex_t pindex, vm_size_t size);
boolean_t pmap_page_exists_quick(pmap_t pmap, vm_page_t m);
void pmap_page_init(vm_page_t m);
+int pmap_page_wired_mappings(vm_page_t m);
int pmap_pinit(pmap_t);
void pmap_pinit0(pmap_t);
void pmap_protect(pmap_t, vm_offset_t, vm_offset_t, vm_prot_t);
OpenPOWER on IntegriCloud