Date: Thu, 11 May 2017 10:52:14 -0700 From: John Baldwin <jhb@freebsd.org> To: Justin Hibbits <jhibbits@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r318171 - head/sys/dev/dpaa Message-ID: <1565622.4efZRtpFtU@ralph.baldwin.cx> In-Reply-To: <201705110347.v4B3lwj4009423@repo.freebsd.org> References: <201705110347.v4B3lwj4009423@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday, May 11, 2017 03:47:58 AM Justin Hibbits wrote: > Author: jhibbits > Date: Thu May 11 03:47:58 2017 > New Revision: 318171 > URL: https://svnweb.freebsd.org/changeset/base/318171 > > Log: > Fix uma_zcreate() align argument, now that the constraint is asserted. > > The alignment argument is the mask of low bits to mask off when allocating > items in a zone, not the block-size alignment. The first one should probably be using UMA_ALIGN_PTR instead. However, I do wonder if we shouldn't fix the API. All of the other APIs in the kernel for memory allocation use the size for alignment (contigmalloc, kmem_*, bus_dma, etc.). We could support a transition for uma by doing something like this in the implementation: if (alignment == 0) zone->align = 0; else if (powerof2(alignment)) zone->align = alignment - 1; else { KASSERT(powerof2(alignment + 1), ...); printf("WARNING: UMA zone %s using old alignment\n"); zone->alignment = alignment; } Along with updating the UMA_ALIGN_* constants which should fix most of the zones in the tree to use the new strategy. In 13 we would turn the printf() into a panic() / KASSERT. -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1565622.4efZRtpFtU>