login
Header Space

 
 

[rfc][patch 1/3] slub: fix small HWCACHE_ALIGN alignment

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <netdev@...>, Linux Kernel Mailing List <linux-kernel@...>, <yanmin_zhang@...>, David Miller <davem@...>, Christoph Lameter <clameter@...>, Eric Dumazet <dada1@...>
Date: Monday, March 3, 2008 - 5:34 am

SLUB should pack even small objects nicely into cachelines if that is what
has been asked for. Use the same algorithm as SLAB for this.

Signed-off-by: Nick Piggin <npiggin@suse.de>
---
Index: linux-2.6/mm/slub.c
===================================================================
--- linux-2.6.orig/mm/slub.c
+++ linux-2.6/mm/slub.c
@@ -1896,12 +1896,15 @@ static unsigned long calculate_alignment
 	 * 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 *));
 }
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[rfc][patch 1/3] slub: fix small HWCACHE_ALIGN alignment, Nick Piggin, (Mon Mar 3, 5:34 am)
Re: [rfc][patch 1/3] slub: fix small HWCACHE_ALIGN alignment, Christoph Lameter, (Mon Mar 3, 3:08 pm)
Re: [rfc][patch 1/3] slub: fix small HWCACHE_ALIGN alignment, Christoph Lameter, (Mon Mar 3, 4:10 pm)
Re: [rfc][patch 1/3] slub: fix small HWCACHE_ALIGN alignment, Christoph Lameter, (Mon Mar 3, 5:16 pm)
Re: [rfc][patch 1/3] slub: fix small HWCACHE_ALIGN alignment, Christoph Lameter, (Wed Mar 5, 5:06 pm)
Re: [rfc][patch 1/3] slub: fix small HWCACHE_ALIGN alignment, Christoph Lameter, (Thu Mar 6, 6:56 pm)
Re: [rfc][patch 1/3] slub: fix small HWCACHE_ALIGN alignment, Christoph Lameter, (Thu Mar 6, 10:26 pm)
Re: [rfc][patch 1/3] slub: fix small HWCACHE_ALIGN alignment, Christoph Lameter, (Thu Mar 6, 10:54 pm)
Re: [rfc][patch 1/3] slub: fix small HWCACHE_ALIGN alignment, Christoph Lameter, (Thu Mar 6, 11:18 pm)
Re: [rfc][patch 1/3] slub: fix small HWCACHE_ALIGN alignment, Christoph Lameter, (Thu Mar 6, 11:58 pm)
Re: [rfc][patch 1/3] slub: fix small HWCACHE_ALIGN alignment, Christoph Lameter, (Mon Mar 3, 5:32 pm)
Re: [rfc][patch 1/3] slub: fix small HWCACHE_ALIGN alignment, Christoph Lameter, (Wed Mar 5, 4:56 pm)
Re: [rfc][patch 1/3] slub: fix small HWCACHE_ALIGN alignment, Christoph Lameter, (Thu Mar 6, 6:53 pm)
Re: [rfc][patch 1/3] slub: fix small HWCACHE_ALIGN alignment, Christoph Lameter, (Thu Mar 6, 10:20 pm)
Re: [rfc][patch 1/3] slub: fix small HWCACHE_ALIGN alignment, Christoph Lameter, (Thu Mar 6, 10:27 pm)
Re: [rfc][patch 1/3] slub: fix small HWCACHE_ALIGN alignment, Christoph Lameter, (Thu Mar 6, 10:33 pm)
[rfc][patch 3/3] use SLAB_ALIGN_SMP, Nick Piggin, (Mon Mar 3, 5:36 am)
Re: [rfc][patch 3/3] use SLAB_ALIGN_SMP, Eric Dumazet, (Mon Mar 3, 5:53 am)
Re: [rfc][patch 3/3] use SLAB_ALIGN_SMP, Nick Piggin, (Mon Mar 3, 8:41 am)
Re: [rfc][patch 3/3] use SLAB_ALIGN_SMP, Eric Dumazet, (Mon Mar 3, 9:00 am)
Re: [rfc][patch 3/3] use SLAB_ALIGN_SMP, Nick Piggin, (Mon Mar 3, 9:46 am)
Re: [rfc][patch 3/3] use SLAB_ALIGN_SMP, Pekka Enberg, (Mon Mar 3, 9:53 am)
Re: [rfc][patch 3/3] use SLAB_ALIGN_SMP, Christoph Lameter, (Mon Mar 3, 3:09 pm)
Re: [rfc][patch 3/3] use SLAB_ALIGN_SMP, Nick Piggin, (Mon Mar 3, 4:10 pm)
Re: [rfc][patch 3/3] use SLAB_ALIGN_SMP, Christoph Lameter, (Mon Mar 3, 4:12 pm)
Re: [rfc][patch 3/3] use SLAB_ALIGN_SMP, Nick Piggin, (Mon Mar 3, 4:18 pm)
Re: [rfc][patch 3/3] use SLAB_ALIGN_SMP, Christoph Lameter, (Mon Mar 3, 5:14 pm)
Re: [rfc][patch 3/3] use SLAB_ALIGN_SMP, Eric Dumazet, (Mon Mar 3, 10:15 am)
Re: [rfc][patch 3/3] use SLAB_ALIGN_SMP, Christoph Lameter, (Mon Mar 3, 3:10 pm)
[rfc][patch 2/3] slab: introduce SMP alignment, Nick Piggin, (Mon Mar 3, 5:35 am)
Re: [rfc][patch 2/3] slab: introduce SMP alignment, Christoph Lameter, (Mon Mar 3, 3:06 pm)
Re: [rfc][patch 2/3] slab: introduce SMP alignment, Nick Piggin, (Mon Mar 3, 4:03 pm)
Re: [rfc][patch 2/3] slab: introduce SMP alignment, Christoph Lameter, (Mon Mar 3, 4:09 pm)
Re: [rfc][patch 2/3] slab: introduce SMP alignment, Nick Piggin, (Mon Mar 3, 4:12 pm)
Re: [rfc][patch 2/3] slab: introduce SMP alignment, Christoph Lameter, (Mon Mar 3, 4:17 pm)
Re: [rfc][patch 2/3] slab: introduce SMP alignment, Nick Piggin, (Mon Mar 3, 4:24 pm)
Re: [rfc][patch 2/3] slab: introduce SMP alignment, Christoph Lameter, (Mon Mar 3, 5:31 pm)
Re: [rfc][patch 2/3] slab: introduce SMP alignment, Nick Piggin, (Fri Mar 7, 12:37 am)
Re: [rfc][patch 2/3] slab: introduce SMP alignment, Christoph Lameter, (Fri Mar 7, 1:11 am)
Re: [rfc][patch 2/3] slab: introduce SMP alignment, Nick Piggin, (Fri Mar 7, 1:19 am)
Re: [rfc][patch 2/3] slab: introduce SMP alignment, Christoph Lameter, (Fri Mar 7, 1:26 am)
Re: [rfc][patch 2/3] slab: introduce SMP alignment, Nick Piggin, (Tue Mar 11, 3:13 am)
Re: [rfc][patch 2/3] slab: introduce SMP alignment, Christoph Lameter, (Wed Mar 12, 2:21 am)
Re: [rfc][patch 2/3] slab: introduce SMP alignment, Nick Piggin, (Fri Mar 7, 1:37 am)
Re: [rfc][patch 2/3] slab: introduce SMP alignment, Nick Piggin, (Tue Mar 4, 8:16 pm)
Re: [rfc][patch 2/3] slab: introduce SMP alignment, Pekka Enberg, (Mon Mar 3, 4:41 pm)
Re: [rfc][patch 2/3] slab: introduce SMP alignment, Christoph Lameter, (Mon Mar 3, 5:23 pm)
speck-geostationary