svn commit: r318171 - head/sys/dev/dpaa

John Baldwin jhb at freebsd.org
Thu May 11 18:14:46 UTC 2017


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


More information about the svn-src-head mailing list