Re: [patch 1/2] bootmem: add alloc_bootmem_align()

From: H. Peter Anvin
Date: Tue Nov 16 2010 - 17:14:37 EST


On 11/16/2010 01:23 PM, Suresh Siddha wrote:
> Index: tree/include/linux/bootmem.h
> ===================================================================
> --- tree.orig/include/linux/bootmem.h
> +++ tree/include/linux/bootmem.h
> @@ -105,6 +105,8 @@ extern void *__alloc_bootmem_low_node(pg
>
> #define alloc_bootmem(x) \
> __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
> +#define alloc_bootmem_align(x, align) \
> + __alloc_bootmem(x, align, __pa(MAX_DMA_ADDRESS))
> #define alloc_bootmem_nopanic(x) \
> __alloc_bootmem_nopanic(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
> #define alloc_bootmem_pages(x) \

[...]

> */
> - init_xstate_buf = alloc_bootmem(xstate_size);
> + init_xstate_buf = alloc_bootmem_align(xstate_size,
> + __alignof__(struct xsave_struct));
> init_xstate_buf->i387.mxcsr = MXCSR_DEFAULT;

Perhaps it would make even more sense to have:

#define alloc_bootmem_alignof(x, type) \
__alloc_bootmem(x, __alignof__(type), __pa(MAX_DMA_ADDRESS))


?

-hpa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/