linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Lameter <cl@linux.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Gavin Guo <gavin.guo@canonical.com>,
	penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	linux@rasmusvillemoes.dk
Subject: Re: [PATCH v3] mm/slab_common: Support the slub_debug boot option on specific object size
Date: Fri, 24 Apr 2015 08:52:37 -0500 (CDT)	[thread overview]
Message-ID: <alpine.DEB.2.11.1504240847270.7582@gentwo.org> (raw)
In-Reply-To: <20150423135106.1411031c362de2a5ef75fd50@linux-foundation.org>

On Thu, 23 Apr 2015, Andrew Morton wrote:
> >
> > +		if (i == 2)
> > +			i = (KMALLOC_SHIFT_LOW - 1);
>
> Can we get rid of this by using something like

Nope index is a ilog2 value of the size. The table changes would not
preserve the mapping of the index to the power of two sizes.

> static struct {
> 	const char *name;
> 	unsigned long size;
> } const kmalloc_names[] __initconst = {
> //	{NULL,                      0},
> 	{"kmalloc-96",             96},
> 	{"kmalloc-192",           192},
> #if KMALLOC_MIN_SIZE <= 8
> 	{"kmalloc-8",               8},
> #endif
> #if KMALLOC_MIN_SIZE <= 16
> 	{"kmalloc-16",             16},
> #endif
> #if KMALLOC_MIN_SIZE <= 32
> 	{"kmalloc-32",             32},
> #endif
> 	{"kmalloc-64",             64},
> 	{"kmalloc-128",           128},
> 	{"kmalloc-256",           256},
> 	{"kmalloc-512",           512},
> 	{"kmalloc-1024",         1024},
> 	{"kmalloc-2048",         2048},
> 	{"kmalloc-4096",         4096},
> 	{"kmalloc-8192",         8192},
> 	...
> };
>

> Why does the initialization code do the
>
> 	if (!kmalloc_caches[i]) {
>
> test?  Can any of these really be initialized?  If so, why is it
> legitimate for create_kmalloc_caches() to go altering size_index[]
> after some caches have already been set up?

Because we know what sizes we need during bootstrap and the initial
caches that are needed to create others are first populated. If they are
already handled by the earliest bootstrap code then we should not
repopulate them later.

> Finally, why does create_kmalloc_caches() use GFP_NOWAIT?  We're in
> __init code!  Makes no sense.  Or if it *does* make sense, the reason
> should be clearly commented.

Well I was told by Pekka to use it exactly because it was init code at
some point. The slab system is not really that functional so I doubt
it makes much of a difference.



--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2015-04-24 13:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-23 13:26 Gavin Guo
2015-04-23 13:56 ` Christoph Lameter
2015-04-23 20:51 ` Andrew Morton
2015-04-24 13:52   ` Christoph Lameter [this message]
2015-04-23 21:01 ` Andrew Morton
2015-04-24 14:36   ` Daniel Sanders

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=alpine.DEB.2.11.1504240847270.7582@gentwo.org \
    --to=cl@linux.com \
    --cc=akpm@linux-foundation.org \
    --cc=gavin.guo@canonical.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox