Re: Question about pmap_kenter

Matthew Dillon <[email protected]> Tue, 25 May 2021 12:08:35 -0900
Newsgroups gmane.os.dragonfly-bsd.kernel
Message-ID <CAOZ7CpCS72+23wCZhTY6A9KW28Ty+pSmJPAafYRX5Thg8gNajw@mail.gmail.com>
--00000000000088ea2905c32dee18
Content-Type: text/plain; charset="UTF-8"

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

--00000000000088ea2905c32dee18
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">The documentation is out of date.<div><br></div><div>pmap_=
kenter() synchronizes the TLB on all CPUs.</div><div><br></div><div>pmap_ke=
nter_quick() only invalidates the TLB on the current cpu.</div><div><br></d=
iv><div>pmap_kenter_noinval() does not touch the TLB at all.</div><div><br>=
</div><div>The latter two functions are only used under controlled circumst=
ances.=C2=A0 pmap_kenter_quick() is used when the caller only intends to us=
e the mapping on the current cpu, or intends to track which cpu&#39;s have =
synchronized the mapping.=C2=A0 =C2=A0And pmap_kenter_noinval() is used whe=
n the caller is entering a ton of PTEs into the pmap and will do a global i=
nvalidation when done.</div><div><br></div><div>pmap_qenter() passes an arg=
ument w/regard to what kind of tlb invalidation is desired.=C2=A0 =C2=A0</d=
iv><div><br></div><div>I should note that the buffer cache code (struct buf=
) tracks mapping validity with a cpu mask, so operations on the buffer cach=
e do not cause an excessive number of global IPIs for SMP invalidations.</d=
iv><div><br></div><div>-Matt</div></div>

--00000000000088ea2905c32dee18--