Page MenuHomeFreeBSD

uma: split slabzone into two sizes
ClosedPublic

Authored by rlibby on Jan 13 2020, 8:53 AM.

Details

Summary

By allowing more items per slab, we can improve memory efficiency for
small allocs. If we were just to increase the bitmap size of the
slabzone, we would then waste slabzone memory. So, split slabzone into
two zones, one especially for 8-byte allocs (512 per slab). The
practical effect should be reduced memory usage for counter(9).

Test Plan

kyua test -k /usr/tests/sys/Kyuafile

Diff Detail

Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 28632
Build 26664: arc lint + arc unit

Event Timeline

rlibby created this revision.Jan 13 2020, 8:53 AM
rlibby added inline comments.Jan 13 2020, 8:56 AM
sys/kern/kern_prot.c
2057

This and the same in subr_bus.c are actually not necessary with a smallest alloc size of 8 bytes, but I needed to fix them when testing with a smallest alloc size of 4 bytes.

jeff accepted this revision.Jan 13 2020, 9:05 AM
jeff added inline comments.
sys/vm/uma_core.c
120

Now that virtually nothing uses a hash zone we should only be using offpage slabs for relatively large allocations. Given that I suspect we could dramatically shrink slabzone0 and save a lot of memory until we can embed slabs in pages. 64bit would be more than enough for any case that uses offpage due to fragmentation.

sys/vm/uma_int.h
428

At this point it feels something like a historical accident to call them hash slabs.

This revision is now accepted and ready to land.Jan 13 2020, 9:05 AM
markj accepted this revision.Jan 13 2020, 2:00 PM
markj added inline comments.
sys/vm/uma_core.c
363

Missing parens.

sys/vm/uma_int.h
428

uma_offpage_slab_t?

441

Missing parens.

rlibby updated this revision to Diff 66691.Jan 13 2020, 5:13 PM
rlibby marked 2 inline comments as done.

markj feedback: style(9)

This revision now requires review to proceed.Jan 13 2020, 5:13 PM
rlibby added inline comments.Jan 13 2020, 5:19 PM
sys/vm/uma_core.c
120

Yes... As-is, we could probably tune slabzone0's size down. But with page-embedded slabs, we might then want to tune it back up, or at least to a different value. Perhaps we wait until we get page-embedded slabs in before we tune?

sys/vm/uma_int.h
428

I agree, it puts the emphasis in the wrong place. I'd like to leave it alone for this commit at least though.

markj accepted this revision.Jan 13 2020, 6:21 PM
markj added inline comments.
sys/kern/kern_prot.c
2057

I'd suggest committing them separately if you weren't already going to.

This revision is now accepted and ready to land.Jan 13 2020, 6:21 PM
rlibby added inline comments.Jan 13 2020, 6:26 PM
sys/kern/kern_prot.c
2057

Okay, I'll split them out.

jeff accepted this revision.Jan 13 2020, 8:32 PM

I am happy to tweak parameters and possibly function names in a follow up patch.

Go ahead with this

This revision was automatically updated to reflect the committed changes.