Page MenuHomeFreeBSD

vm_reserv: Group per-domain data in the same structure.
ClosedPublic

Authored by markj on Nov 15 2019, 11:45 PM.

Details

Summary

We currently have the per-domain partially populated reservation queues
and the per-domain queue locks. Define a new per-domain structure to
contain both of them. This puts the queue fields and lock in the same
cache line and avoids the false sharing within the old queue array.

Also fix field packing in the reservation structure. In many places we
assume that a domain index fits in 8 bits, so we can do the same there
as well. This reduces the size of the structure by 8 bytes.

Update some comments while here. No functional change intended.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 27550
Build 25772: arc lint + arc unit

Event Timeline

I see nothing clearly wrong with this.

sys/vm/vm_reserv.c
247

How much memory do you lose in the gaps between elements?

This revision is now accepted and ready to land.Nov 16 2019, 5:45 AM
kib added inline comments.
sys/vm/vm_reserv.c
247

Whatever it is, removal of mtx_padalign vm_reserv_domain_lock compensates.

sys/vm/vm_reserv.c
247

Indeed, struct mtx_padalign is just a struct mtx with CACHE_LINE_SIZE alignment, so we are actually saving a small amount of memory.