Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933580AbbDWJ4B (ORCPT ); Thu, 23 Apr 2015 05:56:01 -0400 Received: from mail-la0-f47.google.com ([209.85.215.47]:35147 "EHLO mail-la0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932453AbbDWJz7 (ORCPT ); Thu, 23 Apr 2015 05:55:59 -0400 From: Rasmus Villemoes To: Gavin Guo Cc: cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mm/slab_common: Support the slub_debug boot option on specific object size Organization: D03 References: <1429691618-13884-1-git-send-email-gavin.guo@canonical.com> X-Hashcash: 1:20:150423:penberg@kernel.org::FDSogbgtywvdM3Wl:00000000000000000000000000000000000000000000F2R X-Hashcash: 1:20:150423:linux-kernel@vger.kernel.org::YmlydIq8kBJDxzXl:0000000000000000000000000000000000+PN X-Hashcash: 1:20:150423:iamjoonsoo.kim@lge.com::wysqz74HTUHEX8gX:0000000000000000000000000000000000000002Efb X-Hashcash: 1:20:150423:rientjes@google.com::L/R9kwIeIXUXe6bC:0000000000000000000000000000000000000000002rkX X-Hashcash: 1:20:150423:linux-mm@kvack.org::ygzJDDqwVZLNj8rV:00000000000000000000000000000000000000000003dxg X-Hashcash: 1:20:150423:akpm@linux-foundation.org::7UhPdBtM8C1Bpr0P:00000000000000000000000000000000000045xi X-Hashcash: 1:20:150423:cl@linux.com::Ryn6k8qPGNonw8eI:000005GBC X-Hashcash: 1:20:150423:gavin.guo@canonical.com::gsJz1vxEUUni/mmL:000000000000000000000000000000000000007JMh Date: Thu, 23 Apr 2015 11:55:56 +0200 In-Reply-To: <1429691618-13884-1-git-send-email-gavin.guo@canonical.com> (Gavin Guo's message of "Wed, 22 Apr 2015 16:33:38 +0800") Message-ID: <87egnbmamr.fsf@rasmusvillemoes.dk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1858 Lines: 61 On Wed, Apr 22 2015, Gavin Guo wrote: > /* > + * The kmalloc_names is for temporary usage to make > + * slub_debug=,kmalloc-xx option work in the boot time. The > + * kmalloc_index() support to 2^26=64MB. So, the final entry of the > + * table is kmalloc-67108864. > + */ > + static const char *kmalloc_names[] = { The array itself could be const, but more importantly it should be marked __initconst so that the 27*sizeof(char*) bytes can be released after init. > + "0", "kmalloc-96", "kmalloc-192", > + "kmalloc-8", "kmalloc-16", "kmalloc-32", > + "kmalloc-64", "kmalloc-128", "kmalloc-256", > + "kmalloc-512", "kmalloc-1024", "kmalloc-2048", > + "kmalloc-4196", "kmalloc-8192", "kmalloc-16384", "kmalloc-4096" > + "kmalloc-32768", "kmalloc-65536", > + "kmalloc-131072", "kmalloc-262144", > + "kmalloc-524288", "kmalloc-1048576", > + "kmalloc-2097152", "kmalloc-4194304", > + "kmalloc-8388608", "kmalloc-16777216", > + "kmalloc-33554432", "kmalloc-67108864" > + }; On Wed, Apr 22 2015, Andrew Morton wrote: > You could do something like > > kmalloc_caches[i] = create_kmalloc_cache( > kmalloc_names[i], > kstrtoul(kmalloc_names[i] + 8), > flags); > > here, and remove those weird "96" and "192" cases. Eww. At least spell 8 as strlen("kmalloc-"). > Or if that's considered too messy, make it > > static const struct { > const char *name; > unsigned size; > } kmalloc_cache_info[] = { > { NULL, 0 }, > { "kmalloc-96", 96 }, > ... > }; I'd vote for this color for the bikeshed :-) Rasmus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/