UMA and zone alignment

John Baldwin jhb at freebsd.org
Sat Sep 16 16:30:56 UTC 2017


On Saturday, September 16, 2017 07:54:47 AM Ed Schouten wrote:
> 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.

Fixing this part of the UMA API is also on my todo list, but I haven't
gotten to it yet (and this is quicker to fix). 

-- 
John Baldwin


More information about the freebsd-arch mailing list