linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] slab: initialize unused alien cache entry as NULL at alloc_alien_cache().
@ 2009-12-22 12:38 Haicheng Li
  2009-12-22 12:40 ` Andi Kleen
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Haicheng Li @ 2009-12-22 12:38 UTC (permalink / raw)
  To: linux-mm, Christoph Lameter, Pekka Enberg, Matt Mackall, andi,
	linux-kernel

Memory hotplug would online new node in runtime, then reap timer will add this new node as 
a reap node. In such case, for each existing kmem_list, we need to ensure that the alien 
cache entry corresponding to this new added node is NULL. Otherwise, it might cause BUG 
when reap_alien() affecting the new added node.

Signed-off-by: Haicheng Li <haicheng.li@linux.intel.com>
---
  mm/slab.c |    7 +++----
  1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index 7dfa481..a9486a0 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -966,18 +966,17 @@ static void *alternate_node_alloc(struct kmem_cache *, gfp_t);
  static struct array_cache **alloc_alien_cache(int node, int limit, gfp_t gfp)
  {
  	struct array_cache **ac_ptr;
-	int memsize = sizeof(void *) * nr_node_ids;
+	int memsize = sizeof(void *) * MAX_NUMNODES;
  	int i;

  	if (limit > 1)
  		limit = 12;
  	ac_ptr = kmalloc_node(memsize, gfp, node);
  	if (ac_ptr) {
+		memset(ac_ptr, 0, memsize);
  		for_each_node(i) {
-			if (i == node || !node_online(i)) {
-				ac_ptr[i] = NULL;
+			if (i == node || !node_online(i))
  				continue;
-			}
  			ac_ptr[i] = alloc_arraycache(node, limit, 0xbaadf00d, gfp);
  			if (!ac_ptr[i]) {
  				for (i--; i >= 0; i--)
-- 
1.6.0.rc1

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-01-04 17:27 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-22 12:38 [PATCH] slab: initialize unused alien cache entry as NULL at alloc_alien_cache() Haicheng Li
2009-12-22 12:40 ` Andi Kleen
2009-12-22 15:47 ` Christoph Lameter
2009-12-23  6:52   ` Haicheng Li
2009-12-23 10:10     ` Eric Dumazet
2009-12-23 10:23       ` Andi Kleen
2009-12-23 11:23         ` Haicheng Li
2010-01-04 17:26           ` Christoph Lameter
2009-12-22 22:38 ` Matt Mackall
2009-12-23  9:58   ` [PATCH v2] " Haicheng Li
2010-01-04 17:27     ` Christoph Lameter

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