Re: "slab: Fix missing DEBUG_SLAB last user" breaks ARM

From: Christoph Lameter
Date: Tue Feb 08 2011 - 10:02:17 EST


On Tue, 8 Feb 2011, Russell King wrote:

> > I thought the fix was for ARM, actually, but unfortunately the
> > changelog is somewhat terse (shame on me). Hmm?
>
> As you say, the changelog is soo terse that we now have no idea why this
> commit was created.
>
> So, what's the fix here? It looks to me like a revert is in order.
>
> I suggest that if it does get reverted, a copy of my original bug report
> is included in the revert commit so that all the details are available if
> it needs revisiting.

Uhh.. That first hunk in commit 5c5e3b33b7cb959a401f823707bee006caadd76e
looks wrong to me. ralign is usually a power of two and greater than
alignof(unsigned long long). The & operation will result in 0 and never
exempt any caches.

diff --git a/mm/slab.c b/mm/slab.c
index bac0f4f..525c664 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2220,8 +2220,8 @@ kmem_cache_create (const char *name, size_t size,
size_t align,
if (ralign < align) {
ralign = align;
}
- /* disable debug if necessary */
- if (ralign > __alignof__(unsigned long long))
+ /* disable debug if not aligning with REDZONE_ALIGN */
+ if (ralign & (__alignof__(unsigned long long) - 1))
flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
/*
* 4) Store it.


Did you mean

if (ralign > REDZONE_ALIGN) ...

?


--
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/