Page MenuHomeFreeBSD

amd64: compare TLB shootdown target to all_cpus
ClosedPublic

Authored by gallatin on Jan 11 2021, 9:24 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 20 2023, 4:30 AM
Unknown Object (File)
Oct 19 2023, 7:26 AM
Unknown Object (File)
Jul 9 2023, 2:56 PM
Unknown Object (File)
Jun 28 2023, 3:56 PM
Unknown Object (File)
Jun 28 2023, 3:54 PM
Unknown Object (File)
Jun 28 2023, 3:46 PM
Unknown Object (File)
Apr 8 2023, 10:32 AM
Unknown Object (File)
Mar 31 2023, 1:40 PM
Subscribers
None

Details

Summary

On amd64, the pmap code passes all_cpus to smp_targeted_tlb_shootdown() when unmapping from the kernel map. This function has an optimized path to send ipi's to all but itself, which it intends to do when the target is all cpus. However, we need to compare the target cpu mask with all_cpus(), rather than using CPU_ISFULLSET(). Comparing with CPU_ISFULLSET() will only work when we have MAXCPU cpus active in the system, otherwise, we'll be sending repeated ipis, rather than a single ipi to all cpus but ourselves.

Fixing this should reduce the time spent in native_lapic_ipi_wait as we will be sending ipis in parallel, rather than one-by-one. This result is confirmed by dtrace

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

gallatin created this revision.
gallatin added reviewers: kib, jhb, markj, jtl.
kib added a reviewer: alc.
This revision is now accepted and ready to land.Jan 11 2021, 9:31 PM

i386 should probably get the same patch?

i386 should probably get the same patch?

Possibly, but I don't have any i386 to test on, so I'm reluctant to touch it.