Subject: Re: Analysis of kern/6891 (ps output) [Was Re: Semi fix for PR kern/6891]
To: None <thorpej@nas.nasa.gov>
From: John S. Dyson <dyson@iquest.net>
List: tech-kern
Date: 02/01/1999 04:09:06
Jason Thorpe said:
> 
> What I'm thinking about doing on the Alpha and hp300 pmaps is instead
> use a bit to say "entered w/ kenter" in the PV entry, so that the
> desired operations (e.g. pmap_page_protect()) are skipped on those
> mappings, but the info can be tracked for the other needs.
> 
On FreeBSD, the pmap_kenter can be emulated by pmap_enter, depending
on platform.  The purpose of pmap_kenter is to avoid dealing with all
of the complexity of pmap_enter, when it simply isn't needed.  Most
kernel mappings (except where there are aliasing problems, or when files
are mmaped) don't require tracking of the modify and referenced bits.
Pmap_kenter short-circuits the overhead associated with the pmap_kenter
(pmap_kenter means "pmap kernel enter".)  Other data structures provide
the needed tracking for resources.

Actually, using the pv entries in the way that they historically
were, was wrong.  *If* you don't need the physical to virtual mapping
for a given mapping, then don't create a physical to virtual mapping
entry!!! :-).  It was pretty lame to have to skip modified bit checking
by virtual address (that is the way the code used to be.) :-(...  FreeBSD
still has some checks, but AFAIK, they aren't needed anymore, and
certainly never desireable.

Some machines might need a pv instrumented pmap_kenter, and in that case, the
overhead associated with it cannot be avoided.  A good example of valid use
for the pmap_kenter might be kernel malloced areas, buffer cache (to avoid
that totally gross and bogus pte move stuff), and other low level kernel
purposes.  The original pte move stuff in the buffer cache code is an
example of a pseudo-pmap_enter, but without the layering and formalism.

Even on machines with virtual caches can take advantage of pmap_kenter
type constructs (for example, again, the bogus direct pte mgmt in the
buffer cache code), but the advantage would be lessened.

-- 
John                  | Never try to teach a pig to sing,
dyson@iquest.net      | it makes one look stupid
jdyson@nc.com         | and it irritates the pig.