freebsd-skq/sys/vm
alc 012f4aa201 When I pushed down the page queues lock into pmap_is_modified(), I created
an ordering dependence: A pmap operation that clears PG_WRITEABLE and calls
vm_page_dirty() must perform the call first.  Otherwise, pmap_is_modified()
could return FALSE without acquiring the page queues lock because the page
is not (currently) writeable, and the caller to pmap_is_modified() might
believe that the page's dirty field is clear because it has not seen the
effect of the vm_page_dirty() call.

When I pushed down the page queues lock into pmap_is_modified(), I
overlooked one place where this ordering dependence is violated:
pmap_enter().  In a rare situation pmap_enter() can be called to replace a
dirty mapping to one page with a mapping to another page.  (I say rare
because replacements generally occur as a result of a copy-on-write fault,
and so the old page is not dirty.)  This change delays clearing PG_WRITEABLE
until after vm_page_dirty() has been called.

Fixing the ordering dependency also makes it easy to introduce a small
optimization: When pmap_enter() used to replace a mapping to one page with a
mapping to another page, it freed the pv entry for the first mapping and
later called the pv entry allocator for the new mapping.  Now, pmap_enter()
attempts to recycle the old pv entry, saving two calls to the pv entry
allocator.

There is no point in setting PG_WRITEABLE on unmanaged pages, so don't.
Update a comment to reflect this.

Tidy up the variable declarations at the start of pmap_enter().
2010-05-29 17:10:45 +00:00
..
default_pager.c
device_pager.c Eliminate page queues locking around most calls to vm_page_free(). 2010-05-06 18:58:32 +00:00
memguard.c Start copyright notice with /*- 2010-04-07 16:29:10 +00:00
memguard.h Start copyright notice with /*- 2010-04-07 16:29:10 +00:00
phys_pager.c Handle busy status of the page in a way expected for pager_getpage(). 2010-05-03 19:19:58 +00:00
pmap.h Roughly half of a typical pmap_mincore() implementation is machine- 2010-05-24 14:26:57 +00:00
redzone.c
redzone.h
sg_pager.c Eliminate page queues locking around most calls to vm_page_free(). 2010-05-06 18:58:32 +00:00
swap_pager.c Call vm_page_deactivate() rather than vm_page_dontneed() in 2010-05-09 16:27:42 +00:00
swap_pager.h
uma_core.c It makes more sense for the object-based backend allocator to use OBJT_PHYS 2010-05-03 17:35:31 +00:00
uma_dbg.c
uma_dbg.h
uma_int.h - enable alignment on amd64 only 2010-03-22 22:39:32 +00:00
uma.h
vm_contig.c Continue cleaning the queue instead of moving to the next queue or 2010-05-10 11:53:40 +00:00
vm_extern.h o) Add a VM find-space option, VMFS_TLB_ALIGNED_SPACE, which searches the 2010-04-18 22:32:07 +00:00
vm_fault.c When waiting for the busy page, do not unlock the object unless unlock 2010-05-20 08:51:01 +00:00
vm_glue.c Eliminate page queues locking around most calls to vm_page_free(). 2010-05-06 18:58:32 +00:00
vm_init.c Align the start of the clean submap to a superpage boundary. Although 2010-02-21 22:23:13 +00:00
vm_kern.c The pages allocated by kmem_alloc_attr() and kmem_malloc() are unmanaged. 2010-05-03 07:08:16 +00:00
vm_kern.h
vm_map.c Push down page queues lock acquisition in pmap_enter_object() and 2010-05-26 18:00:44 +00:00
vm_map.h o) Add a VM find-space option, VMFS_TLB_ALIGNED_SPACE, which searches the 2010-04-18 22:32:07 +00:00
vm_meter.c
vm_mmap.c Push down page queues lock acquisition in pmap_enter_object() and 2010-05-26 18:00:44 +00:00
vm_object.c Roughly half of a typical pmap_mincore() implementation is machine- 2010-05-24 14:26:57 +00:00
vm_object.h VI_OBJDIRTY vnode flag mirrors the state of OBJ_MIGHTBEDIRTY vm object 2009-12-21 12:29:38 +00:00
vm_page.c Push down page queues lock acquisition in pmap_enter_object() and 2010-05-26 18:00:44 +00:00
vm_page.h When I pushed down the page queues lock into pmap_is_modified(), I created 2010-05-29 17:10:45 +00:00
vm_pageout.c Roughly half of a typical pmap_mincore() implementation is machine- 2010-05-24 14:26:57 +00:00
vm_pageout.h Add a helper function vm_pageout_page_lock(), similar to tegge' 2010-05-06 04:57:33 +00:00
vm_pager.c
vm_pager.h
vm_param.h On Alan's advice, rather than do a wholesale conversion on a single 2010-04-30 00:46:43 +00:00
vm_phys.c
vm_phys.h
vm_reserv.c
vm_reserv.h
vm_unix.c
vm_zeroidle.c Split P_NOLOAD into a per-thread flag (TDF_NOLOAD). 2009-11-03 16:46:52 +00:00
vm.h Replace VM_PROT_OVERRIDE_WRITE by VM_PROT_COPY. VM_PROT_OVERRIDE_WRITE has 2009-11-26 05:16:07 +00:00
vnode_pager.c Push down page queues lock acquisition in pmap_enter_object() and 2010-05-26 18:00:44 +00:00
vnode_pager.h