Page MenuHomeFreeBSD

uma: Let uma_zone_reserve() do preallocation as well
Needs ReviewPublic

Authored by markj on Nov 10 2020, 10:28 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 8 2023, 4:12 AM
Unknown Object (File)
Sep 29 2023, 2:31 AM
Unknown Object (File)
Apr 26 2023, 4:01 AM
Unknown Object (File)
Apr 8 2023, 10:28 AM
Unknown Object (File)
Jan 10 2023, 8:16 AM
Unknown Object (File)
Dec 31 2022, 8:48 PM
Unknown Object (File)
Dec 19 2022, 8:51 AM
Subscribers
None

Details

Reviewers
jeff
rlibby
alc
Summary

Otherwise uma_zone_reserve() calls are always paired with a
uma_prealloc() call, but the latter doesn't really do the right thing on
NUMA systems: uk_reserve is a per-domain quantity, but uma_prealloc()
treats the number of items as a global quantity and divides over the set
of NUMA domains.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 34732
Build 31788: arc lint + arc unit

Event Timeline

markj created this revision.

I like simplifiying and clarifying the API.

I'm still a little unclear on what the new semantics are though. Can you remind me why we (sometimes?) need the reservation to be per domain, and not distributed among them? Is it just because we only have the accounting per domain? And what is the difference between first touch and round robin with respect to the reserve?

Also, kmapentzone has been added since you originally posted this.

sys/kern/subr_vmem.c
726–728

I don't think I noticed this before. Why do we do the prealloc before installing our allocf? I guess this doesn't trip ZONE_ASSERT_COLD() as coded... kmapentzone is also now doing this.

sys/vm/uma_core.c
1521

"into the partial slab list" is now partially stale.

1632–1635

In my opinion, it wouldn't be terrible to move this into keg_prealloc_slab (simlar to how uma_prealloc used to be). The reason is, that would avoid adding a prealloc param (and the wrapper) for keg_alloc_slab, and prealloc is rare whereas normal alloc is not.

1662

On fail (slab == NULL) we don't own the keg lock.

4791–4792

So, for round robin the reserve/prealloc is global and not per domain? Would appreciate a comment here.

I'm still a little unclear on what the new semantics are though. Can you remind me why we (sometimes?) need the reservation to be per domain, and not distributed among them? Is it just because we only have the accounting per domain? And what is the difference between first touch and round robin with respect to the reserve?

So maybe this should have been obvious. Presumably with first touch, we may need to satisfy the entire reserve from any particular domain whereas with round robin we are free to cast about?