Re: linux-next: Tree for June 23

From: Pekka J Enberg
Date: Mon Jun 23 2008 - 14:56:28 EST


On Mon, 23 Jun 2008, Vegard Nossum wrote:
> Okay, I can confirm that this happens with today's tree too. I also
> get this (new) warning:
>
> mm/slub.c: In function 'kmem_cache_defrag':
> mm/slub.c:3046: warning: 'reclaimed' may be used uninitialized in this function
>
> Otherwise things seem to work good :-)

Christoph, while the warning itself seems harmless, I think we need to do
something like the following; otherwise the return value for
kmem_cache_defrag() will be incorrect on NUMA machines that have more than
one N_NORMAL_MEMORY nodes.

Pekka

diff --git a/mm/slub.c b/mm/slub.c
index deb8153..7707550 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3043,7 +3043,7 @@ int kmem_cache_defrag(int node)
return 0;

list_for_each_entry(s, &slab_caches, list) {
- unsigned long reclaimed;
+ unsigned long reclaimed = 0;

/*
* Defragmentable caches come first. If the slab cache is not
@@ -3056,7 +3056,7 @@ int kmem_cache_defrag(int node)
int nid;

for_each_node_state(nid, N_NORMAL_MEMORY)
- reclaimed = __kmem_cache_shrink(s, nid,
+ reclaimed += __kmem_cache_shrink(s, nid,
MAX_PARTIAL);
} else
reclaimed = __kmem_cache_shrink(s, node, MAX_PARTIAL);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/