Re: [patch -v2] flat: fix data sections alignment

From: Paul Mundt
Date: Thu Mar 05 2009 - 03:47:20 EST


On Wed, Mar 04, 2009 at 02:51:17PM +0100, Johannes Weiner wrote:
> Paul, please note that on sh ARCH_SLAB_MINALIGN is defined to be 8
> while the userspace stack was aligned to 4 before. I suppose aligning
> the stack (and data sections) to 8 as well is the right thing...?
>
This is intentional. As I noted before, the ARCH_SLAB_MINALIGN on SH
refers specifically to SH-5 (or anything implementing a 32-bit sh64 ABI),
which presently does not support nommu, but could in theory. The SH parts
that do nommu today generally need ARCH_KMALLOC_MINALIGN, but do not have
the ARCH_SLAB_MINALIGN requirement that SH-5 does.

> --- a/fs/binfmt_flat.c
> +++ b/fs/binfmt_flat.c
> @@ -41,6 +41,7 @@
> #include <asm/uaccess.h>
> #include <asm/unaligned.h>
> #include <asm/cacheflush.h>
> +#include <asm/page.h>
>
> /****************************************************************************/
>
> @@ -54,6 +55,12 @@
> #define DBG_FLT(a...)
> #endif
>
> +#ifdef ARCH_SLAB_MINALIGN
> +#define FLAT_DATA_ALIGN (ARCH_SLAB_MINALIGN)
> +#else
> +#define FLAT_DATA_ALIGN (sizeof(void *))
> +#endif
> +
As it's not entirely obvious what this is used for outside of the slab
context, you will want to have a comment here explaining the situation,
and particularly what the implication for stack alignment is.
--
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/