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
Unknown Object (File)
Wed, May 8, 5:25 AM
Unknown Object (File)
Sat, May 4, 12:00 AM
Unknown Object (File)
Thu, May 2, 8:14 PM
Unknown Object (File)
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
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 27855
Build 26029: 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
2357

Fix indentation while here?

sys/vm/uma_int.h
147

Missing a period in the comment.

154

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

263

Where is this used?

304

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

315

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
993

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

995–997

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

1053–1054

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.

1187–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.

505

Cast is now unnecessary?