Question about pmap_kenter

James Cook falsifian at falsifian.org
Fri May 28 12:41:00 PDT 2021


On Tue, May 25, 2021 at 12:08:35PM -0900, Matthew Dillon wrote:
> The documentation is out of date.
> 
> pmap_kenter() synchronizes the TLB on all CPUs.
> 
> pmap_kenter_quick() only invalidates the TLB on the current cpu.
> 
> pmap_kenter_noinval() does not touch the TLB at all.
> 
> The latter two functions are only used under controlled circumstances.
> pmap_kenter_quick() is used when the caller only intends to use the mapping
> on the current cpu, or intends to track which cpu's have synchronized the
> mapping.   And pmap_kenter_noinval() is used when the caller is entering a
> ton of PTEs into the pmap and will do a global invalidation when done.
> 
> pmap_qenter() passes an argument w/regard to what kind of tlb invalidation
> is desired.
> 
> I should note that the buffer cache code (struct buf) tracks mapping
> validity with a cpu mask, so operations on the buffer cache do not cause an
> excessive number of global IPIs for SMP invalidations.
> 
> -Matt

Thanks for confirming my suspicion, and for the extra detail. I haven't
been looking at the buffer cache but will keep your note in mind.

I have been keeping track of some of the out-of-date comments I come
across, and just compiled some of what I found into a patch (along with
a little bit of new documentation):

    https://bugs.dragonflybsd.org/issues/3279

I hope it's helpful. I realize developer time is limited, but if you
think it's worth your time to review things like that I'll probably
keep sending them :-)

-- 
James



More information about the Kernel mailing list