From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756306AbZFKNoR (ORCPT ); Thu, 11 Jun 2009 09:44:17 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753743AbZFKNny (ORCPT ); Thu, 11 Jun 2009 09:43:54 -0400 Received: from smtp3.ultrahosting.com ([74.213.175.254]:52330 "EHLO smtp.ultrahosting.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754930AbZFKNnx (ORCPT ); Thu, 11 Jun 2009 09:43:53 -0400 Date: Thu, 11 Jun 2009 09:43:47 -0400 (EDT) From: Christoph Lameter X-X-Sender: cl@gentwo.org To: Pekka J Enberg cc: linux-kernel@vger.kernel.org, mel@csn.ul.ie, Larry.Finger@lwfinger.net Subject: Re: [PATCH 2/2] SLUB: Disable debugging if it increases the minimum page order In-Reply-To: Message-ID: References: User-Agent: Alpine 1.10 (DEB 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We have had that with SLAB. NO! This leads to the situation that some slabs have debug on and some have not. You just do not know which. Note that CONFIG_SLUB_DEBUG only enables the code to debug a slab. It does not enable debugging for each slab. CONFIG_SLUB_DEBUG_ON does that. On Thu, 11 Jun 2009, Pekka J Enberg wrote: > From: Pekka Enberg > > 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 > Cc: Larry Finger > Cc: Mel Gorman > Signed-off-by: Pekka Enberg > --- > 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; > >