Page MenuHomeFreeBSD

Use a variant structure for hash and offpage zones to save space.
ClosedPublic

Authored by jeff on Nov 29 2019, 9:03 PM.
Tags
None
Referenced Files
F81989463: D22609.diff
Wed, Apr 24, 5:38 AM
Unknown Object (File)
Mar 7 2024, 11:29 PM
Unknown Object (File)
Jan 27 2024, 1:28 AM
Unknown Object (File)
Jan 20 2024, 8:30 PM
Unknown Object (File)
Jan 1 2024, 11:40 AM
Unknown Object (File)
Dec 20 2023, 1:42 AM
Unknown Object (File)
Oct 4 2023, 1:43 PM
Unknown Object (File)
Sep 18 2023, 4:39 AM
Subscribers

Details

Summary

This is a relatively minor memory savings but I like the code refactoring that resulted from it.

On a freshly booted system I am using ~2MB of memory for off page slab structures. It may make sense to make a small version and a large version. I believe that was originally a feature of UMA.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 27899
Build 26070: arc lint + arc unit

Event Timeline

jeff added reviewers: rlibby, markj.
jeff set the repository for this revision to rS FreeBSD src repository - subversion.
sys/vm/uma_core.c
2394–2395

Fix indentation while here?

sys/vm/uma_int.h
147

Missing a period in the comment.

154–155

This looks like it should be de-indented by one tab.

263

Where is this used?

303

Missing parens around the return value. The parens around slab and the cast are redundant.

314

Missing parens around the return value.

sys/vm/uma_int.h
263

relic of an aborted attempt to make a minimum size slab and maximum size slab zone.

markj added inline comments.
sys/vm/uma_int.h
158

Is the purpose of changing from SLIST to LIST to make this cheaper?

This revision is now accepted and ready to land.Dec 3 2019, 4:27 PM

Looks good! Below are a couple style comments, and a couple other drive by comments.

sys/vm/uma_core.c
994

Is this not better described as slab_data(slab, keg)?

996–998

Counting backward may not be a good idea if it defeats prefetch.

1054–1055

Not sure if this is perf sensitive or how long the loop is, but instead of adjusting uk_pages and uk_free in the loop, we could just count (n++) and then do the adjustment below the loop.

1188–1191

Easier to read in the positive direction:

if (keg->uk_flags & UMA_ZONE_OFFPAGE)
        ((uma_hash_slab_t)slab)->uhs_data = mem;
else
        slab = (uma_slab_t )(mem + keg->uk_pgoff);

Ditto in slab_data().

sys/vm/uma_int.h
241

Curious, why is this a keg member? It seems it's always (uk_flags & UMA_ZONE_OFFPAGE) ? slabzone : NULL.

488

Cast is now unnecessary?