Skip to content

Commit 3ac38fa

Browse files
akpm00torvalds
authored andcommitted
mm/slub.c: use register_hotmemory_notifier()
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>
1 parent 8f68fa2 commit 3ac38fa

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎mm/slub.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/slab.h>
1919
#include "slab.h"
2020
#include <linux/proc_fs.h>
21+
#include <linux/notifier.h>
2122
#include <linux/seq_file.h>
2223
#include <linux/kmemcheck.h>
2324
#include <linux/cpu.h>
@@ -3483,7 +3484,6 @@ int kmem_cache_shrink(struct kmem_cache *s)
34833484
}
34843485
EXPORT_SYMBOL(kmem_cache_shrink);
34853486

3486-
#if defined(CONFIG_MEMORY_HOTPLUG)
34873487
static int slab_mem_going_offline_callback(void *arg)
34883488
{
34893489
struct kmem_cache *s;
@@ -3598,7 +3598,10 @@ static int slab_memory_callback(struct notifier_block *self,
35983598
return ret;
35993599
}
36003600

3601-
#endif /* CONFIG_MEMORY_HOTPLUG */
3601+
static struct notifier_block slab_memory_callback_nb = {
3602+
.notifier_call = slab_memory_callback,
3603+
.priority = SLAB_CALLBACK_PRI,
3604+
};
36023605

36033606
/********************************************************************
36043607
* Basic setup of slabs
@@ -3651,7 +3654,7 @@ void __init kmem_cache_init(void)
36513654
create_boot_cache(kmem_cache_node, "kmem_cache_node",
36523655
sizeof(struct kmem_cache_node), SLAB_HWCACHE_ALIGN);
36533656

3654-
hotplug_memory_notifier(slab_memory_callback, SLAB_CALLBACK_PRI);
3657+
register_hotmemory_notifier(&slab_memory_callback_nb);
36553658

36563659
/* Able to allocate the per node structures */
36573660
slab_state = PARTIAL;

0 commit comments

Comments
 (0)