[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080418000618.0c46c78f.akpm@linux-foundation.org>
Date: Fri, 18 Apr 2008 00:06:18 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Benjamin Herrenschmidt <benh@...nel.crashing.org>
Cc: Paul Mackerras <paulus@...ba.org>, <linuxppc-dev@...abs.org>,
<linux-kernel@...r.kernel.org>,
Linux-Arch <linux-arch@...r.kernel.org>
Subject: Re: [PATCH 2/3] [POWERPC] Fix kernel stack allocation alignment
On Fri, 18 Apr 2008 16:56:17 +1000 Benjamin Herrenschmidt <benh@...nel.crashing.org> wrote:
> The powerpc kernel stacks need to be naturally aligned, as they
> contain the thread info at the bottom, which is obtained by
> clearing the low bits of the stack pointer.
>
> However, when using 64K pages (the stack is smaller than a page),
> we use kmalloc to allocate it, which doesn't provide that guarantee.
>
> It appeared to work so far... until one enables SLUB debugging
> which then returns unaligned pointers. Ooops...
>
> This patch fixes it by using a slab cache with enforced alignment
> for those. It replies on my previous patch that adds a
> thread_info_cache_init() callback.
>
> ...
>
> +void thread_info_cache_init(void)
> +{
> + thread_info_cache = kmem_cache_create("thread_info", THREAD_SIZE,
> + THREAD_SIZE, 0, NULL);
> + BUG_ON(thread_info_cache == NULL);
> +}
so... the "0" defeats all of SLAB_DEBUG_FREE, SLAB_RED_ZONE, SLAB_POISON
and SLAB_STORE_USER, if the comment in slab.h is to be believed.
Was that overkill?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists