From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A2C2CB700A for ; Fri, 29 Jun 2012 10:45:43 +1000 (EST) Message-ID: <1340930720.2563.5.camel@pasglop> Subject: Re: [PATCH powerpc 2/2] kfree the cache name of pgtable cache if SLUB is used From: Benjamin Herrenschmidt To: Li Zhong Date: Fri, 29 Jun 2012 10:45:20 +1000 In-Reply-To: <1340618099.13778.39.camel@ThinkPad-T420> References: <1340617984.13778.37.camel@ThinkPad-T420> <1340618099.13778.39.camel@ThinkPad-T420> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Cc: Christoph Lameter , LKML , Pekka Enberg , linux-mm , Paul Mackerras , Matt Mackall , PowerPC email list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Mon, 2012-06-25 at 17:54 +0800, Li Zhong wrote: > diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c > index 620b7ac..c9d2a7f 100644 > --- a/arch/powerpc/mm/init_64.c > +++ b/arch/powerpc/mm/init_64.c > @@ -130,6 +130,9 @@ void pgtable_cache_add(unsigned shift, void > (*ctor)(void *)) > align = max_t(unsigned long, align, minalign); > name = kasprintf(GFP_KERNEL, "pgtable-2^%d", shift); > new = kmem_cache_create(name, table_size, align, 0, ctor); > +#ifdef CONFIG_SLUB > + kfree(name); /* SLUB duplicates the cache name */ > +#endif > PGT_CACHE(shift) = new; > > pr_debug("Allocated pgtable cache for order %d\n", shift); This is very gross ... and fragile. Also the subtle difference in semantics between SLUB and SLAB is a VERY BAD IDEA. I reckon you should make the other allocators all copy the name instead. Ben. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx205.postini.com [74.125.245.205]) by kanga.kvack.org (Postfix) with SMTP id 6F1A06B005A for ; Thu, 28 Jun 2012 20:45:35 -0400 (EDT) Message-ID: <1340930720.2563.5.camel@pasglop> Subject: Re: [PATCH powerpc 2/2] kfree the cache name of pgtable cache if SLUB is used From: Benjamin Herrenschmidt Date: Fri, 29 Jun 2012 10:45:20 +1000 In-Reply-To: <1340618099.13778.39.camel@ThinkPad-T420> References: <1340617984.13778.37.camel@ThinkPad-T420> <1340618099.13778.39.camel@ThinkPad-T420> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Sender: owner-linux-mm@kvack.org List-ID: To: Li Zhong Cc: LKML , Christoph Lameter , Pekka Enberg , Matt Mackall , Paul Mackerras , linux-mm , PowerPC email list On Mon, 2012-06-25 at 17:54 +0800, Li Zhong wrote: > diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c > index 620b7ac..c9d2a7f 100644 > --- a/arch/powerpc/mm/init_64.c > +++ b/arch/powerpc/mm/init_64.c > @@ -130,6 +130,9 @@ void pgtable_cache_add(unsigned shift, void > (*ctor)(void *)) > align = max_t(unsigned long, align, minalign); > name = kasprintf(GFP_KERNEL, "pgtable-2^%d", shift); > new = kmem_cache_create(name, table_size, align, 0, ctor); > +#ifdef CONFIG_SLUB > + kfree(name); /* SLUB duplicates the cache name */ > +#endif > PGT_CACHE(shift) = new; > > pr_debug("Allocated pgtable cache for order %d\n", shift); This is very gross ... and fragile. Also the subtle difference in semantics between SLUB and SLAB is a VERY BAD IDEA. I reckon you should make the other allocators all copy the name instead. Ben. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754370Ab2F2Apt (ORCPT ); Thu, 28 Jun 2012 20:45:49 -0400 Received: from gate.crashing.org ([63.228.1.57]:37511 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752746Ab2F2Aps (ORCPT ); Thu, 28 Jun 2012 20:45:48 -0400 Message-ID: <1340930720.2563.5.camel@pasglop> Subject: Re: [PATCH powerpc 2/2] kfree the cache name of pgtable cache if SLUB is used From: Benjamin Herrenschmidt To: Li Zhong Cc: LKML , Christoph Lameter , Pekka Enberg , Matt Mackall , Paul Mackerras , linux-mm , PowerPC email list Date: Fri, 29 Jun 2012 10:45:20 +1000 In-Reply-To: <1340618099.13778.39.camel@ThinkPad-T420> References: <1340617984.13778.37.camel@ThinkPad-T420> <1340618099.13778.39.camel@ThinkPad-T420> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2012-06-25 at 17:54 +0800, Li Zhong wrote: > diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c > index 620b7ac..c9d2a7f 100644 > --- a/arch/powerpc/mm/init_64.c > +++ b/arch/powerpc/mm/init_64.c > @@ -130,6 +130,9 @@ void pgtable_cache_add(unsigned shift, void > (*ctor)(void *)) > align = max_t(unsigned long, align, minalign); > name = kasprintf(GFP_KERNEL, "pgtable-2^%d", shift); > new = kmem_cache_create(name, table_size, align, 0, ctor); > +#ifdef CONFIG_SLUB > + kfree(name); /* SLUB duplicates the cache name */ > +#endif > PGT_CACHE(shift) = new; > > pr_debug("Allocated pgtable cache for order %d\n", shift); This is very gross ... and fragile. Also the subtle difference in semantics between SLUB and SLAB is a VERY BAD IDEA. I reckon you should make the other allocators all copy the name instead. Ben.