Page MenuHomeFreeBSD

uma: reorganize flags

Authored by rlibby on Jan 3 2020, 1:27 AM.


Group Reviewers
rS356534: uma: reorganize flags
  • Move flag VTOSLAB from public to private.
  • Introduce public NOTPAGE flag and make HASH private.
  • Introduce public NOTOUCH flag and make OFFPAGE private.
  • Update man page.

The net effect of this should be to make the contract with clients more
clear. Clients should choose constraints, UMA will figure out how to
implement them. This also breaks the confusing double meaning of

Please feel free to suggest better ways to spell NOTOUCH or NOTPAGE or
better wording for the comments and man page.

Test Plan

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

Diff Detail

rS FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

rlibby created this revision.Jan 3 2020, 1:27 AM
markj accepted this revision.Jan 3 2020, 4:54 PM

NOTOUCH seems like a good name to me. NOTPAGE is ok with me. NOTVM might be a bit clearer, but it also might be confused with the unrelated M_NOVM.

296 ↗(On Diff #66286)

"The UMA subsystem"?

1884 ↗(On Diff #66286)

Should we KASSERT that NOTPAGE is not set?

1929 ↗(On Diff #66286)

I see that this assignment moved to keg_small_init(), but why?

This revision is now accepted and ready to land.Jan 3 2020, 4:54 PM
rlibby added inline comments.Jan 3 2020, 7:24 PM
296 ↗(On Diff #66286)

Sure, will do.

1884 ↗(On Diff #66286)

Yes... or just set HASH if NOTPAGE. It's a fair point. Would you mind if I deferred this comment to an upcoming patch where the three keg_..._init procedures are unified? Sneak peak, but more changes coming:

1929 ↗(On Diff #66286)

It's fine here, it didn't have to move. The reason I moved it is at line 1736, keg_small_init still needed to check either for OFFPAGE or for PCPU being set. It felt weird to me to check for NOTPAGE|OFFPAGE, especially as OFFPAGE really meant PCPU. Additionally I liked better having it so that only keg_..._init controlled the setting of OFFPAGE/HASH.

markj added inline comments.Jan 3 2020, 9:49 PM
1884 ↗(On Diff #66286)

Sure, that's fine. My comment is just nitpicking.

1929 ↗(On Diff #66286)

That seems reasonable to me.

jeff accepted this revision.Jan 4 2020, 4:59 AM

I should have umaperf committed in a day or two.

1163 ↗(On Diff #66286)

In another patch, we do not need a pointer here. Even if we return to a system with multiple slab zones we can select it via the keg size and flags so that we don't have to cache a pointer to a global.

1805 ↗(On Diff #66286)

I wonder whether it is faster to use vtoslab() or uk_pgoff to lookup the slab for direct mapped architectures with a single page. I guess it is a cache miss to the vm_page vs a cache miss to the keg structure so pgoff should still be faster. Still I could be wrong.

4026 ↗(On Diff #66286)

This is actually the most likely case. We may see a minor benefit from restructuring this whole block. It is also very similar to uma_dbg_getslab() which is weirdly not in uma_dbg.c.

This revision was automatically updated to reflect the committed changes.