Page MenuHomeFreeBSD

Make uma_int.h friendlier to userspace.
ClosedPublic

Authored by markj on Mar 5 2020, 7:12 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 22 2024, 3:31 PM
Unknown Object (File)
Feb 10 2024, 2:06 AM
Unknown Object (File)
Jan 25 2024, 1:55 PM
Unknown Object (File)
Jan 24 2024, 6:42 AM
Unknown Object (File)
Jan 11 2024, 11:45 PM
Unknown Object (File)
Jan 1 2024, 4:52 AM
Unknown Object (File)
Dec 17 2023, 12:18 PM
Unknown Object (File)
Nov 3 2023, 2:24 AM
Subscribers

Details

Summary

I have a program that uses libkvm to dump the address of each slab
allocated to a zone. The intent is to measure fragmentation caused by
_NOFREE zones. When updating the program to catch up with all of the
UMA changes, I ended up simplifying uma_int.h a little bit:

  • Make slab_sizeof(), slab_space() and slab_ipers() local to uma_core.c. I can't see why they need to be exported, and they don't follow the UMA namespace conventions. Note that a couple of these functions are unused.
  • Group KEG_ASSERT_COLD with other keg macros.
  • Stop defining the slab structures under _KERNEL. There's no real reason they can't be visible to userspace like the rest of UMA's structures are.
  • Remove an assertion about MAXMEMDOM - there are tons of places in the tree that assume that a domain index fits in 8 bits.

No functional change intended.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/vm/uma_core.c
1962–1966 ↗(On Diff #69237)

If this is no longer used and libby does not plan on using it let's remove it.

sys/vm/uma_int.h
396 ↗(On Diff #69237)

What does removing this get us? I added it so that you could find failures explicitly. Otherwise it may be hard to know.

sys/vm/uma_core.c
1962–1966 ↗(On Diff #69237)

Ok, I just wanted to make sure you were both ok with that first.

sys/vm/uma_int.h
396 ↗(On Diff #69237)

I can re-add it, I think it just needs to be kernel-only. We make this assumption all over the place, FWIW, and there are pad bytes following the domain field on 64-bit platforms. Maybe it should be domainid_t instead.

Looks good except SLAB_BITSETS and Jeff's comments.

sys/vm/uma_core.c
1962–1966 ↗(On Diff #69237)

Yep, go ahead. I think this got left behind with the startup alloc changes.

sys/vm/uma_int.h
394–402 ↗(On Diff #69237)

This can't make sense to user space and should either remain under _KERNEL or move to uma_core.c.

396 ↗(On Diff #69237)

Incidentally, if you are changing it, it can be written with _Static_assert.

This revision is now accepted and ready to land.Mar 6 2020, 10:20 PM
markj marked 3 inline comments as done.
  • Remove dead functions.
  • Move SLAB_BITSETS to uma_core.c.
  • Restore the MAXMEMDOM assertion, I missed that it is checking MAXMEMDOM < 255, not MAXMEMDOM <= 255.
This revision now requires review to proceed.Mar 7 2020, 12:44 AM
This revision is now accepted and ready to land.Mar 7 2020, 12:52 AM
This revision was automatically updated to reflect the committed changes.