freebsd-dev/sys/i386
Alan Cox 8f0d5d3b9f 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
..
acpica Use the same policy for rejecting / not-reject ACPI tables with incorrect 2010-03-19 12:43:18 +00:00
bios Introduce the new kernel sub-tree x86 which should contain all the code 2010-02-25 14:13:39 +00:00
compile
conf Change USB_DEBUG to #ifdef and allow it to be turned off. Previously this had 2010-04-22 21:31:34 +00:00
i386 When I pushed down the page queues lock into pmap_is_modified(), I created 2010-05-29 17:10:45 +00:00
ibcs2 Reorganize syscall entry and leave handling. 2010-05-23 18:32:02 +00:00
include Add support for corrected machine check interrupts. CMCI is a new local 2010-05-24 15:45:05 +00:00
isa Introduce the new kernel sub-tree x86 which should contain all the code 2010-02-25 14:13:39 +00:00
linux Reorganize syscall entry and leave handling. 2010-05-23 18:32:02 +00:00
pci number of cleanups in i386 and amd64 pci md code 2009-09-24 07:11:23 +00:00
svr4 Change some movl's to mov's. Newer GAS no longer accept 'movl' instructions 2009-01-31 11:37:21 +00:00
xbox Update d_mmap() to accept vm_ooffset_t and vm_memattr_t. 2009-12-29 21:51:28 +00:00
xen Push down page queues lock acquisition in pmap_enter_object() and 2010-05-26 18:00:44 +00:00
Makefile Update entries for building tags. 2007-05-13 18:21:54 +00:00