linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: submit@firstfloor.org, linux-kernel@vger.kernel.org,
	haicheng.li@intel.com, penberg@cs.helsinki.fi,
	linux-mm@kvack.org
Subject: [PATCH] [2/4] SLAB: Set up the l3 lists for the memory of freshly added memory
Date: Wed,  3 Feb 2010 22:39:13 +0100 (CET)	[thread overview]
Message-ID: <20100203213913.D5CD4B1620@basil.firstfloor.org> (raw)
In-Reply-To: <201002031039.710275915@firstfloor.org>


So kmalloc_node() works even if no CPU is up yet on the new node.

Requires previous refactor patch.

Signed-off-by: Andi Kleen <ak@linux.intel.com>

---
 mm/slab.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Index: linux-2.6.33-rc3-ak/mm/slab.c
===================================================================
--- linux-2.6.33-rc3-ak.orig/mm/slab.c
+++ linux-2.6.33-rc3-ak/mm/slab.c
@@ -115,6 +115,7 @@
 #include	<linux/reciprocal_div.h>
 #include	<linux/debugobjects.h>
 #include	<linux/kmemcheck.h>
+#include	<linux/memory.h>
 
 #include	<asm/cacheflush.h>
 #include	<asm/tlbflush.h>
@@ -1560,6 +1561,20 @@ void __init kmem_cache_init(void)
 	g_cpucache_up = EARLY;
 }
 
+static int slab_memory_callback(struct notifier_block *self,
+				unsigned long action, void *arg)
+{
+	struct memory_notify *mn = (struct memory_notify *)arg;
+
+	/*
+	 * When a node goes online allocate l3s early.	 This way
+	 * kmalloc_node() works for it.
+	 */
+	if (action == MEM_ONLINE && mn->status_change_nid >= 0)
+		slab_node_prepare(mn->status_change_nid);
+	return NOTIFY_OK;
+}
+
 void __init kmem_cache_init_late(void)
 {
 	struct kmem_cache *cachep;
@@ -1583,6 +1598,8 @@ void __init kmem_cache_init_late(void)
 	 */
 	register_cpu_notifier(&cpucache_notifier);
 
+	hotplug_memory_notifier(slab_memory_callback, SLAB_CALLBACK_PRI);
+
 	/*
 	 * The reap timers are started later, with a module init call: That part
 	 * of the kernel is not yet operational.

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

  parent reply	other threads:[~2010-02-03 21:39 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-03 21:39 [PATCH] [0/4] SLAB: Fix a couple of slab memory hotadd issues Andi Kleen
2010-02-03 21:39 ` [PATCH] [1/4] SLAB: Handle node-not-up case in fallback_alloc() Andi Kleen
2010-02-05 21:06   ` David Rientjes
2010-02-06  7:25     ` Andi Kleen
2010-02-06  9:53       ` David Rientjes
2010-02-06 15:56         ` Andi Kleen
2010-02-06 22:31           ` David Rientjes
2010-02-03 21:39 ` Andi Kleen [this message]
2010-02-05 19:12   ` [PATCH] [2/4] SLAB: Set up the l3 lists for the memory of freshly added memory Christoph Lameter
2010-02-05 21:17   ` David Rientjes
2010-02-06  7:26     ` Andi Kleen
2010-02-06  9:47       ` David Rientjes
2010-02-03 21:39 ` [PATCH] [3/4] SLAB: Separate node initialization into separate function Andi Kleen
2010-02-05 19:15   ` Christoph Lameter
2010-02-05 21:29   ` David Rientjes
2010-02-06  7:27     ` Andi Kleen
2010-02-06  9:55       ` David Rientjes
2010-02-03 21:39 ` [PATCH] [4/4] SLAB: Fix node add timer race in cache_reap Andi Kleen
2010-02-05 19:16   ` Christoph Lameter
2010-02-05  8:27 ` [PATCH] [0/4] SLAB: Fix a couple of slab memory hotadd issues Pekka Enberg
2010-02-05 19:19 ` Christoph Lameter
2010-02-05 20:22   ` Andi Kleen
2010-02-05 20:55     ` Christoph Lameter

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=20100203213913.D5CD4B1620@basil.firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=haicheng.li@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@cs.helsinki.fi \
    --cc=submit@firstfloor.org \
    /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