cvs commit: src/sys/alpha/alpha pmap.c src/sys/amd64/amd64 pmap.c src/sys/i386/i386 pmap.c

Alan Cox alc at FreeBSD.org
Sun Sep 19 14:20:02 PDT 2004


alc         2004-09-19 21:20:02 UTC

  FreeBSD src repository

  Modified files:
    sys/alpha/alpha      pmap.c 
    sys/amd64/amd64      pmap.c 
    sys/i386/i386        pmap.c 
  Log:
  Simplify the reference counting of page table pages.  Specifically, use
  the page table page's wired count rather than its hold count to contain
  the reference count.  My rationale for this change is based on several
  factors:
  
  1. The machine-independent and pmap layers used the same hold count field
     in subtly different ways.  The machine-independent layer uses the hold
     count to implement a form of ephemeral wiring that is used by pipes,
     physio, etc.  In other words, subsystems where we wish to temporarily
     block a page from being swapped out while it is mapped into the kernel's
     address space.  Such pages are never removed from the page queues.
     Instead, the page daemon recognizes a non-zero hold count to mean "hands
     off this page."  In contrast, page table pages are never in the page
     queues; they are wired from birth to death.  The hold count was being
     used as a kind of reference count, specifically, the number of valid
     page table entries within the page.  Not surprisingly, these two
     different uses imply different synchronization rules: in the machine-
     independent layer access to the hold count requires the page queues
     lock; whereas in the pmap layer the pmap lock is required.  Thus,
     continued use by the pmap layer of vm_page_unhold(), which asserts that
     the page queues lock is held, made no sense.
  
  2. _pmap_unwire_pte_hold() was too forgiving in its handling of the wired
     count.  An unexpected wired count on a page table page was ignored and
     the underlying page leaked.
  
  3. In a word, microoptimization.  Using the wired count exclusively, rather
     than a combination of the wired and hold counts, makes the code slightly
     smaller and faster.
  
  Reviewed by: tegge@
  
  Revision  Changes    Path
  1.171     +10 -22    src/sys/alpha/alpha/pmap.c
  1.501     +15 -27    src/sys/amd64/amd64/pmap.c
  1.507     +10 -22    src/sys/i386/i386/pmap.c


More information about the cvs-src mailing list