Page MenuHomeFreeBSD

Batch v_wire_count updates in the pmap code.
ClosedPublic

Authored by markj on Jul 31 2017, 1:39 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 18 2024, 7:02 PM
Unknown Object (File)
Dec 20 2023, 5:20 AM
Unknown Object (File)
Nov 15 2023, 3:04 PM
Unknown Object (File)
Nov 12 2023, 2:37 PM
Unknown Object (File)
Nov 7 2023, 9:56 AM
Unknown Object (File)
Nov 7 2023, 4:00 AM
Unknown Object (File)
Oct 14 2023, 2:10 PM
Unknown Object (File)
Oct 9 2023, 1:36 PM
Subscribers
None

Details

Summary

Atomic updates to v_wire_count are a significant source of contention,
so help reduce this by decrementing v_wire_count only once when freeing
a set of page table pages.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib added inline comments.
sys/amd64/amd64/pmap.c
2215 ↗(On Diff #31364)

for (count = 0; ((m = SLIST_FIRST()) != NULL; count++) {} ?

This revision is now accepted and ready to land.Jul 31 2017, 7:25 AM
sys/amd64/amd64/pmap.c
2331 ↗(On Diff #31364)

Is sending an IPI a serializing operation? If so, then doesn't every possible method of TLB invalidation contain at least one serializing operation? If that's the case, then this seems pointless.

I think that a comment at the head of the TLB invalidation functions about their serializing effects would be better.

sys/amd64/amd64/pmap.c
2331 ↗(On Diff #31364)

What do you mean by pointless ? The rel fence above or the whole change ? rel is only a compiler barrier.

That said, sending IPI (as opposed to act on IPI) is not obligatory serializing. I added mfence to x2APIC-mode IPI-send to be compatible with xAPIC mode, since there was some code depending on the effects before IPI visible to IPI handler. But this is not enforced by hardware and might be optimized to avoid fence if possible.

sys/amd64/amd64/pmap.c
2331 ↗(On Diff #31364)

The rel fence above or the whole change ?

Just the release fence. I'm questioning whether we shouldn't just remove this whole snippet. (There is also the inherent ordering of stores on the x86 to consider.)

Otherwise, I like the change.

sys/amd64/amd64/pmap.c
2331 ↗(On Diff #31364)

Just an observation ... This release fence is inherited from the i386 pmap, where it is immediately followed by a TLB invalidation on the recursive mapping.

markj edited edge metadata.

Address review feedback:

  • Use a for-loop in pmap_free_zero_pages().
  • Remove fences in _pmap_unwire_ptp(). While ipi_cpu() is not necessarily serializing, x86 has TSO.
This revision now requires review to proceed.Aug 1 2017, 4:40 AM
This revision is now accepted and ready to land.Aug 1 2017, 5:12 AM
This revision was automatically updated to reflect the committed changes.