All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@iki.fi>
To: Daniel Sanders <daniel.sanders@imgtec.com>
Cc: Christoph Lameter <cl@linux.com>,
	Pekka Enberg <penberg@kernel.org>,
	David Rientjes <rientjes@google.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/5] slab: Correct size_index table before replacing the bootstrap kmem_cache_node.
Date: Thu, 05 Feb 2015 10:37:32 +0200	[thread overview]
Message-ID: <54D32BCC.1010608@iki.fi> (raw)
In-Reply-To: <1423084015-24010-1-git-send-email-daniel.sanders@imgtec.com>


On 02/04/2015 11:06 PM, Daniel Sanders wrote:
> This patch moves the initialization of the size_index table slightly
> earlier so that the first few kmem_cache_node's can be safely allocated
> when KMALLOC_MIN_SIZE is large.
>
> There are currently two ways to generate indices into kmalloc_caches
> (via kmalloc_index() and via the size_index table in slab_common.c)
> and on some arches (possibly only MIPS) they potentially disagree with
> each other until create_kmalloc_caches() has been called. It seems
> that the intention is that the size_index table is a fast equivalent
> to kmalloc_index() and that create_kmalloc_caches() patches the table
> to return the correct value for the cases where kmalloc_index()'s
> if-statements apply.
>
> The failing sequence was:
> * kmalloc_caches contains NULL elements
> * kmem_cache_init initialises the element that 'struct
>    kmem_cache_node' will be allocated to. For 32-bit Mips, this is a
>    56-byte struct and kmalloc_index returns KMALLOC_SHIFT_LOW (7).
> * init_list is called which calls kmalloc_node to allocate a 'struct
>    kmem_cache_node'.
> * kmalloc_slab selects the kmem_caches element using
>    size_index[size_index_elem(size)]. For MIPS, size is 56, and the
>    expression returns 6.
> * This element of kmalloc_caches is NULL and allocation fails.
> * If it had not already failed, it would have called
>    create_kmalloc_caches() at this point which would have changed
>    size_index[size_index_elem(size)] to 7.
>
> Signed-off-by: Daniel Sanders <daniel.sanders@imgtec.com>
> Cc: Christoph Lameter <cl@linux.com>
> Cc: Pekka Enberg <penberg@kernel.org>
> Cc: David Rientjes <rientjes@google.com>
> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org

Acked-by: Pekka Enberg <penberg@kernel.org>

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

WARNING: multiple messages have this Message-ID (diff)
From: Pekka Enberg <penberg@iki.fi>
To: Daniel Sanders <daniel.sanders@imgtec.com>
Cc: Christoph Lameter <cl@linux.com>,
	Pekka Enberg <penberg@kernel.org>,
	David Rientjes <rientjes@google.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/5] slab: Correct size_index table before replacing the bootstrap kmem_cache_node.
Date: Thu, 05 Feb 2015 10:37:32 +0200	[thread overview]
Message-ID: <54D32BCC.1010608@iki.fi> (raw)
In-Reply-To: <1423084015-24010-1-git-send-email-daniel.sanders@imgtec.com>


On 02/04/2015 11:06 PM, Daniel Sanders wrote:
> This patch moves the initialization of the size_index table slightly
> earlier so that the first few kmem_cache_node's can be safely allocated
> when KMALLOC_MIN_SIZE is large.
>
> There are currently two ways to generate indices into kmalloc_caches
> (via kmalloc_index() and via the size_index table in slab_common.c)
> and on some arches (possibly only MIPS) they potentially disagree with
> each other until create_kmalloc_caches() has been called. It seems
> that the intention is that the size_index table is a fast equivalent
> to kmalloc_index() and that create_kmalloc_caches() patches the table
> to return the correct value for the cases where kmalloc_index()'s
> if-statements apply.
>
> The failing sequence was:
> * kmalloc_caches contains NULL elements
> * kmem_cache_init initialises the element that 'struct
>    kmem_cache_node' will be allocated to. For 32-bit Mips, this is a
>    56-byte struct and kmalloc_index returns KMALLOC_SHIFT_LOW (7).
> * init_list is called which calls kmalloc_node to allocate a 'struct
>    kmem_cache_node'.
> * kmalloc_slab selects the kmem_caches element using
>    size_index[size_index_elem(size)]. For MIPS, size is 56, and the
>    expression returns 6.
> * This element of kmalloc_caches is NULL and allocation fails.
> * If it had not already failed, it would have called
>    create_kmalloc_caches() at this point which would have changed
>    size_index[size_index_elem(size)] to 7.
>
> Signed-off-by: Daniel Sanders <daniel.sanders@imgtec.com>
> Cc: Christoph Lameter <cl@linux.com>
> Cc: Pekka Enberg <penberg@kernel.org>
> Cc: David Rientjes <rientjes@google.com>
> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org

Acked-by: Pekka Enberg <penberg@kernel.org>

  reply	other threads:[~2015-02-05  8:37 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-03 13:37 [PATCH 0/5] MIPS: LLVMLinux: Patches to enable compilation of a working kernel for MIPS using Clang/LLVM Daniel Sanders
2015-02-03 13:37 ` Daniel Sanders
2015-02-03 13:37 ` Daniel Sanders
2015-02-03 13:37 ` [PATCH 1/5] LLVMLinux: Correct size_index table before replacing the bootstrap kmem_cache_node Daniel Sanders
2015-02-03 13:37   ` Daniel Sanders
2015-02-03 15:14   ` Christoph Lameter
2015-02-03 15:14     ` Christoph Lameter
2015-02-03 16:00     ` Daniel Sanders
2015-02-03 16:00       ` Daniel Sanders
2015-02-04 20:52       ` [PATCH v2 " Daniel Sanders
2015-02-04 20:52         ` Daniel Sanders
2015-02-04 21:06       ` [PATCH v3 1/5] slab: " Daniel Sanders
2015-02-04 21:06         ` Daniel Sanders
2015-02-05  8:37         ` Pekka Enberg [this message]
2015-02-05  8:37           ` Pekka Enberg
2015-02-04 19:33   ` [PATCH 1/5] LLVMLinux: " Pekka Enberg
2015-02-04 19:33     ` Pekka Enberg
2015-02-04 20:38     ` Daniel Sanders
2015-02-04 20:38       ` Daniel Sanders
2015-02-04 20:42       ` Pekka Enberg
2015-02-04 20:42         ` Pekka Enberg
2015-02-04 21:08         ` Daniel Sanders
2015-02-04 21:08           ` Daniel Sanders
2015-02-03 13:37 ` [PATCH 2/5] MIPS: LLVMLinux: Fix a 'cast to type not present in union' error Daniel Sanders
2015-02-03 13:37   ` Daniel Sanders
2015-02-03 13:37 ` [PATCH 3/5] MIPS: LLVMLinux: Fix an 'inline asm input/output type mismatch' error Daniel Sanders
2015-02-03 13:37   ` Daniel Sanders
2015-02-04 12:57   ` Maciej W. Rozycki
2015-02-05 15:43     ` Daniel Sanders
2015-02-06 10:09       ` Maciej W. Rozycki
2015-02-09 11:33   ` [PATCH v2 " Daniel Sanders
2015-02-09 11:33     ` Daniel Sanders
2015-02-09 14:12     ` Maciej W. Rozycki
2015-02-09 16:44     ` [PATCH v3 " Daniel Sanders
2015-02-09 16:44       ` Daniel Sanders
2015-02-03 13:37 ` [PATCH 4/5] MIPS: LLVMLinux: Silence variable self-assignment warnings Daniel Sanders
2015-02-03 13:37   ` Daniel Sanders
2015-02-03 13:37 ` [PATCH 5/5] MIPS: LLVMLinux: Silence unicode warnings when preprocessing assembly Daniel Sanders
2015-02-03 13:37   ` Daniel Sanders
2015-02-04 10:36   ` Maciej W. Rozycki
2015-02-05 10:25     ` Toma Tabacu
2015-02-05 12:35       ` Maciej W. Rozycki
2015-02-05 12:56         ` Måns Rullgård
2015-02-05 12:56           ` Måns Rullgård
2015-02-11 17:37           ` Daniel Sanders
2015-02-11 17:37             ` Daniel Sanders
2015-02-11 17:37             ` 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=54D32BCC.1010608@iki.fi \
    --to=penberg@iki.fi \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=daniel.sanders@imgtec.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 \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.