Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Sep 2017 07:54:47 +0100
From:      Ed Schouten <ed@nuxi.nl>
To:        John Baldwin <jhb@freebsd.org>
Cc:        "freebsd-arch@freebsd.org" <freebsd-arch@freebsd.org>
Subject:   Re: UMA and zone alignment
Message-ID:  <CABh_MKnyDp-FjN38cmXCUq9SHLBdcQbTrekvjwU948=oWE70RA@mail.gmail.com>
In-Reply-To: <10066620.9raPCKhsf8@ralph.baldwin.cx>
References:  <10066620.9raPCKhsf8@ralph.baldwin.cx>

next in thread | previous in thread | raw e-mail | index | archive | help
2017-09-16 0:38 GMT+01:00 John Baldwin <jhb@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@nuxi.nl>
Nuxi, 's-Hertogenbosch, the Netherlands



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CABh_MKnyDp-FjN38cmXCUq9SHLBdcQbTrekvjwU948=oWE70RA>