UMA and zone alignment
Ed Schouten
ed at nuxi.nl
Sat Sep 16 06:55:20 UTC 2017
2017-09-16 0:38 GMT+01:00 John Baldwin <jhb at freebsd.org>:
> I think I'd like to add UMA_ALIGNOF() and encourage UMA zones to use
> UMA_ALIGNOF(type) instead of UMA_ALIGN_PTR, etc. going forward. This would
> mean UMA would then honor 'struct foo { ... } __aligned(XX)', etc. What do
> you all think?
Awesome!
Random remark: it looks like uma_zcreate() already takes the size of
the objects to allocate without any wrapping; it's just sizeof(...).
Wouldn't we be able to do this for alignment as well?
More specifically, if all of the UMA_ALIGN_* definitions were
incremented by one and uma_zcreate() decrements it, we could eliminate
the UMA_ALIGNOF() macro entirely and simply use _Alignof() at the call
site directly.
If people don't like _Alignof()'s spelling, we could always consider
making something like <stdalign.h> available in kernel space.
--
Ed Schouten <ed at nuxi.nl>
Nuxi, 's-Hertogenbosch, the Netherlands
More information about the freebsd-arch
mailing list