cvs commit: src/sys/amd64/amd64 pmap.c src/sys/arm/arm pmap.c
src/sys/i386/i386 pmap.c src/sys/ia64/ia64 pmap.c
src/sys/powerpc/powerpc mmu_if.m mmu_oea.c pmap_dispatch.c
src/sys/sparc64/sparc64 pmap.c src/sys/sun4v/sun4v pmap.c ...
Alan Cox
alc at FreeBSD.org
Sat Nov 17 14:52:30 PST 2007
alc 2007-11-17 22:52:30 UTC
FreeBSD src repository
Modified files:
sys/amd64/amd64 pmap.c
sys/arm/arm pmap.c
sys/i386/i386 pmap.c
sys/ia64/ia64 pmap.c
sys/powerpc/powerpc mmu_if.m mmu_oea.c pmap_dispatch.c
sys/sparc64/sparc64 pmap.c
sys/sun4v/sun4v pmap.c
sys/vm pmap.h vm_object.c
Log:
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
Revision Changes Path
1.594 +29 -0 src/sys/amd64/amd64/pmap.c
1.89 +21 -0 src/sys/arm/arm/pmap.c
1.599 +31 -0 src/sys/i386/i386/pmap.c
1.193 +32 -0 src/sys/ia64/ia64/pmap.c
1.8 +15 -0 src/sys/powerpc/powerpc/mmu_if.m
1.116 +22 -0 src/sys/powerpc/powerpc/mmu_oea.c
1.11 +7 -0 src/sys/powerpc/powerpc/pmap_dispatch.c
1.168 +20 -0 src/sys/sparc64/sparc64/pmap.c
1.41 +28 -0 src/sys/sun4v/sun4v/pmap.c
1.81 +1 -0 src/sys/vm/pmap.h
1.387 +13 -1 src/sys/vm/vm_object.c
More information about the cvs-src
mailing list