public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] SLUB: Disable debugging if it increases the minimum page order
@ 2009-06-11  8:44 Pekka J Enberg
  2009-06-11 13:43 ` Christoph Lameter
  0 siblings, 1 reply; 13+ messages in thread
From: Pekka J Enberg @ 2009-06-11  8:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: cl, mel, Larry.Finger

From: Pekka Enberg <penberg@cs.helsinki.fi>

As CONFIG_SLUB_DEBUG is almost always enabled, we need to disable debugging on
per-cache basis if the added debug metadata increases minimum page order. This
is a problem for large caches such as kmalloc-4096 as seen in the following
bugzilla report:

  http://bugzilla.kernel.org/show_bug.cgi?id=13319

Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
 mm/slub.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index 2bbacfc..45080d3 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2385,6 +2385,16 @@ static int calculate_sizes(struct kmem_cache *s, int forced_order)
 
 }
 
+#define MAX_DEBUG_SIZE (3 * sizeof(void *) + 2 * sizeof(struct track))
+
+static bool must_disable_debug(size_t size)
+{
+	/*
+	 * Disable debugging if it increases the minimum page order.
+	 */
+	return get_order(size + MAX_DEBUG_SIZE) > get_order(size);
+}
+
 static int kmem_cache_open(struct kmem_cache *s, gfp_t gfpflags,
 		const char *name, size_t size,
 		size_t align, unsigned long flags,
@@ -2397,6 +2407,9 @@ static int kmem_cache_open(struct kmem_cache *s, gfp_t gfpflags,
 	s->align = align;
 	s->flags = kmem_cache_flags(size, flags, name, ctor);
 
+	if (must_disable_debug(size))
+		s->flags &= ~(SLAB_POISON|SLAB_RED_ZONE|SLAB_STORE_USER);
+
 	if (!calculate_sizes(s, -1))
 		goto error;
 
-- 
1.6.0.4


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

end of thread, other threads:[~2009-06-11 19:17 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-11  8:44 [PATCH 2/2] SLUB: Disable debugging if it increases the minimum page order Pekka J Enberg
2009-06-11 13:43 ` Christoph Lameter
2009-06-11 14:00   ` Pekka Enberg
2009-06-11 14:24     ` Christoph Lameter
2009-06-11 15:11       ` Pekka Enberg
2009-06-11 15:20         ` Christoph Lameter
2009-06-11 15:28           ` Pekka Enberg
2009-06-11 15:49             ` Christoph Lameter
2009-06-11 16:49               ` Larry Finger
2009-06-11 18:04               ` Mel Gorman
2009-06-11 18:26                 ` Christoph Lameter
2009-06-11 19:16                   ` Mel Gorman
2009-06-11 14:39     ` Larry Finger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox