LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: Gavin Guo <gavin.guo@canonical.com>
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
Date: Thu, 23 Apr 2015 11:55:56 +0200	[thread overview]
Message-ID: <87egnbmamr.fsf@rasmusvillemoes.dk> (raw)
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")

On Wed, Apr 22 2015, Gavin Guo <gavin.guo@canonical.com> 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 <akpm@linux-foundation.org> 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

  parent reply	other threads:[~2015-04-23  9:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-22  8:33 Gavin Guo
2015-04-22 14:27 ` Christoph Lameter
2015-04-22 21:00 ` Andrew Morton
2015-04-22 21:02   ` Andrew Morton
2015-04-23  3:10   ` Gavin Guo
2015-04-23  3:28     ` Andrew Morton
2015-04-23  9:55 ` Rasmus Villemoes [this message]
2015-04-23 11:15   ` Gavin Guo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87egnbmamr.fsf@rasmusvillemoes.dk \
    --to=linux@rasmusvillemoes.dk \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=gavin.guo@canonical.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --subject='Re: [PATCH v2] mm/slab_common: Support the slub_debug boot option on specific object size' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).