From a442888f2bcb68c104b12f72c7d514a784e00da7 Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Wed, 5 Mar 2008 14:05:56 -0800 Subject: [PATCH] --- yaml --- r: 87052 b: refs/heads/master c: b6210386787728b84db25adc4f1eba70440a4c73 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/mm/slub.c | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index b96c1f0e8ef6..9d6b3db21b1e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 1c61fc40fc264059ff41a614ed2d899127288281 +refs/heads/master: b6210386787728b84db25adc4f1eba70440a4c73 diff --git a/trunk/mm/slub.c b/trunk/mm/slub.c index a96e11c77fd9..96d63eb3ab17 100644 --- a/trunk/mm/slub.c +++ b/trunk/mm/slub.c @@ -1856,12 +1856,15 @@ static unsigned long calculate_alignment(unsigned long flags, * The hardware cache alignment cannot override the specified * alignment though. If that is greater then use it. */ - if ((flags & SLAB_HWCACHE_ALIGN) && - size > cache_line_size() / 2) - return max_t(unsigned long, align, cache_line_size()); + if (flags & SLAB_HWCACHE_ALIGN) { + unsigned long ralign = cache_line_size(); + while (size <= ralign / 2) + ralign /= 2; + align = max(align, ralign); + } if (align < ARCH_SLAB_MINALIGN) - return ARCH_SLAB_MINALIGN; + align = ARCH_SLAB_MINALIGN; return ALIGN(align, sizeof(void *)); }