mm/slub.c: use register_hotmemory_notifier()
authorAndrew Morton <akpm@linux-foundation.org>
Mon, 29 Apr 2013 22:08:06 +0000 (15:08 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 29 Apr 2013 22:54:36 +0000 (15:54 -0700)
Squishes a statement-with-no-effect warning, removes some ifdefs and
shrinks .text by 2 bytes.

Note that this code fails to check for blocking_notifier_chain_register()
failures.

Cc: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/slub.c

index 4aec537..a0206df 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -18,6 +18,7 @@
 #include <linux/slab.h>
 #include "slab.h"
 #include <linux/proc_fs.h>
+#include <linux/notifier.h>
 #include <linux/seq_file.h>
 #include <linux/kmemcheck.h>
 #include <linux/cpu.h>
@@ -3483,7 +3484,6 @@ int kmem_cache_shrink(struct kmem_cache *s)
 }
 EXPORT_SYMBOL(kmem_cache_shrink);
 
-#if defined(CONFIG_MEMORY_HOTPLUG)
 static int slab_mem_going_offline_callback(void *arg)
 {
        struct kmem_cache *s;
@@ -3598,7 +3598,10 @@ static int slab_memory_callback(struct notifier_block *self,
        return ret;
 }
 
-#endif /* CONFIG_MEMORY_HOTPLUG */
+static struct notifier_block slab_memory_callback_nb = {
+       .notifier_call = slab_memory_callback,
+       .priority = SLAB_CALLBACK_PRI,
+};
 
 /********************************************************************
  *                     Basic setup of slabs
@@ -3651,7 +3654,7 @@ void __init kmem_cache_init(void)
        create_boot_cache(kmem_cache_node, "kmem_cache_node",
                sizeof(struct kmem_cache_node), SLAB_HWCACHE_ALIGN);
 
-       hotplug_memory_notifier(slab_memory_callback, SLAB_CALLBACK_PRI);
+       register_hotmemory_notifier(&slab_memory_callback_nb);
 
        /* Able to allocate the per node structures */
        slab_state = PARTIAL;