netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [rfc][patch 1/3] slub: fix small HWCACHE_ALIGN alignment
@ 2008-03-03  9:34 Nick Piggin
  2008-03-03  9:35 ` [rfc][patch 2/3] slab: introduce SMP alignment Nick Piggin
                   ` (3 more replies)
  0 siblings, 4 replies; 68+ messages in thread
From: Nick Piggin @ 2008-03-03  9:34 UTC (permalink / raw)
  To: netdev, Linux Kernel Mailing List, yanmin_zhang, David Miller,
	Christoph Lameter


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 *));
 }

^ permalink raw reply	[flat|nested] 68+ messages in thread

end of thread, other threads:[~2008-03-12  6:22 UTC | newest]

Thread overview: 68+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-03  9:34 [rfc][patch 1/3] slub: fix small HWCACHE_ALIGN alignment Nick Piggin
2008-03-03  9:35 ` [rfc][patch 2/3] slab: introduce SMP alignment Nick Piggin
2008-03-03 19:06   ` Christoph Lameter
2008-03-03 20:03     ` Nick Piggin
2008-03-03 20:09       ` Christoph Lameter
2008-03-03 20:12         ` Nick Piggin
2008-03-03 20:17           ` Christoph Lameter
2008-03-03 20:24             ` Nick Piggin
2008-03-03 20:41               ` Pekka Enberg
2008-03-03 21:23                 ` Christoph Lameter
2008-03-03 21:31               ` Christoph Lameter
2008-03-05  0:16                 ` Nick Piggin
2008-03-07  4:37                 ` Nick Piggin
2008-03-07  5:11                   ` Christoph Lameter
2008-03-07  5:19                     ` Nick Piggin
2008-03-07  5:26                       ` Christoph Lameter
2008-03-07  5:37                         ` Nick Piggin
2008-03-11  7:13                         ` Nick Piggin
2008-03-12  6:21                           ` Christoph Lameter
2008-03-03  9:36 ` [rfc][patch 3/3] use SLAB_ALIGN_SMP Nick Piggin
2008-03-03  9:53   ` Eric Dumazet
2008-03-03 12:41     ` Nick Piggin
2008-03-03 13:00       ` Eric Dumazet
2008-03-03 13:46         ` Nick Piggin
2008-03-03 13:53           ` Pekka Enberg
2008-03-03 14:15             ` Eric Dumazet
2008-03-03 19:10               ` Christoph Lameter
2008-03-03 19:09             ` Christoph Lameter
2008-03-03 20:10               ` Nick Piggin
2008-03-03 20:12                 ` Christoph Lameter
2008-03-03 20:18                   ` Nick Piggin
2008-03-03 21:14                     ` Christoph Lameter
2008-03-03  9:44 ` [rfc][patch 1/3] slub: fix small HWCACHE_ALIGN alignment Pekka Enberg
2008-03-03 12:28   ` Nick Piggin
2008-03-03 19:08 ` Christoph Lameter
2008-03-03 20:06   ` Nick Piggin
2008-03-03 20:10     ` Christoph Lameter
2008-03-03 20:17       ` Nick Piggin
2008-03-03 21:16         ` Christoph Lameter
2008-03-03 21:30           ` Pekka Enberg
2008-03-03 21:32             ` Christoph Lameter
2008-03-03 21:35               ` Pekka Enberg
2008-03-05  0:28                 ` Nick Piggin
2008-03-05 20:56                   ` Christoph Lameter
2008-03-06  2:49                     ` Nick Piggin
2008-03-06 22:53                       ` Christoph Lameter
2008-03-07  2:04                         ` Nick Piggin
2008-03-07  2:20                           ` Christoph Lameter
2008-03-07  2:25                             ` Nick Piggin
2008-03-07  2:27                               ` Christoph Lameter
2008-03-07  2:33                                 ` Nick Piggin
2008-03-07  2:33                                   ` Christoph Lameter
2008-03-07  5:23                                     ` Nick Piggin
2008-03-05  0:08               ` Nick Piggin
2008-03-05  0:06           ` Nick Piggin
2008-03-05  0:10             ` David Miller
2008-03-05 21:06               ` Christoph Lameter
2008-03-06  2:57                 ` Nick Piggin
2008-03-06 22:56                   ` Christoph Lameter
2008-03-07  2:23                     ` Nick Piggin
2008-03-07  2:26                       ` Christoph Lameter
2008-03-07  2:32                         ` Nick Piggin
2008-03-07  2:54                           ` Christoph Lameter
2008-03-07  3:10                             ` Nick Piggin
2008-03-07  3:18                               ` Christoph Lameter
2008-03-07  3:22                                 ` Nick Piggin
2008-03-07  3:58                                   ` Christoph Lameter
2008-03-07  4:05                                     ` Nick Piggin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).