Skip to content

Commit 4932381

Browse files
Michal Hockotorvalds
authored andcommitted
mm, memory_hotplug: move movable_node to the hotplug proper
movable_node_is_enabled is defined in memblock proper while it is initialized from the memory hotplug proper. This is quite messy and it makes a dependency between the two so move movable_node along with the helper functions to memory_hotplug. To make it more entertaining the kernel parameter is ignored unless CONFIG_HAVE_MEMBLOCK_NODE_MAP=y because we do not have the node information for each memblock otherwise. So let's warn when the option is disabled. Link: http://lkml.kernel.org/r/20170529114141.536-4-mhocko@kernel.org Signed-off-by: Michal Hocko <mhocko@suse.com> Acked-by: Reza Arbab <arbab@linux.vnet.ibm.com> Acked-by: Vlastimil Babka <vbabka@suse.cz> Cc: Mel Gorman <mgorman@suse.de> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Jerome Glisse <jglisse@redhat.com> Cc: Yasuaki Ishimatsu <yasu.isimatu@gmail.com> Cc: Xishi Qiu <qiuxishi@huawei.com> Cc: Kani Toshimitsu <toshi.kani@hpe.com> Cc: Chen Yucong <slaoub@gmail.com> Cc: Joonsoo Kim <js1304@gmail.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: David Rientjes <rientjes@google.com> Cc: Daniel Kiper <daniel.kiper@oracle.com> Cc: Igor Mammedov <imammedo@redhat.com> Cc: Vitaly Kuznetsov <vkuznets@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent f70029b commit 4932381

4 files changed

Lines changed: 16 additions & 8 deletions

File tree

‎include/linux/memblock.h‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ struct memblock {
5757

5858
extern struct memblock memblock;
5959
extern int memblock_debug;
60-
/* If movable_node boot option specified */
61-
extern bool movable_node_enabled;
6260

6361
#ifdef CONFIG_ARCH_DISCARD_MEMBLOCK
6462
#define __init_memblock __meminit
@@ -172,11 +170,6 @@ static inline bool memblock_is_hotpluggable(struct memblock_region *m)
172170
return m->flags & MEMBLOCK_HOTPLUG;
173171
}
174172

175-
static inline bool __init_memblock movable_node_is_enabled(void)
176-
{
177-
return movable_node_enabled;
178-
}
179-
180173
static inline bool memblock_is_mirror(struct memblock_region *m)
181174
{
182175
return m->flags & MEMBLOCK_MIRROR;

‎include/linux/memory_hotplug.h‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ extern void __online_page_free(struct page *page);
115115
extern int try_online_node(int nid);
116116

117117
extern bool memhp_auto_online;
118+
/* If movable_node boot option specified */
119+
extern bool movable_node_enabled;
120+
static inline bool movable_node_is_enabled(void)
121+
{
122+
return movable_node_enabled;
123+
}
118124

119125
#ifdef CONFIG_MEMORY_HOTREMOVE
120126
extern bool is_pageblock_removable_nolock(struct page *page);
@@ -266,6 +272,10 @@ static inline void put_online_mems(void) {}
266272
static inline void mem_hotplug_begin(void) {}
267273
static inline void mem_hotplug_done(void) {}
268274

275+
static inline bool movable_node_is_enabled(void)
276+
{
277+
return false;
278+
}
269279
#endif /* ! CONFIG_MEMORY_HOTPLUG */
270280

271281
#ifdef CONFIG_MEMORY_HOTREMOVE

‎mm/memblock.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ struct memblock memblock __initdata_memblock = {
5454
};
5555

5656
int memblock_debug __initdata_memblock;
57-
bool movable_node_enabled __initdata_memblock = false;
5857
static bool system_has_some_mirror __initdata_memblock = false;
5958
static int memblock_can_resize __initdata_memblock;
6059
static int memblock_memory_in_slab __initdata_memblock = 0;

‎mm/memory_hotplug.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ static struct {
7979
#define memhp_lock_acquire() lock_map_acquire(&mem_hotplug.dep_map)
8080
#define memhp_lock_release() lock_map_release(&mem_hotplug.dep_map)
8181

82+
bool movable_node_enabled = false;
83+
8284
#ifndef CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE
8385
bool memhp_auto_online;
8486
#else
@@ -1572,7 +1574,11 @@ check_pages_isolated(unsigned long start_pfn, unsigned long end_pfn)
15721574

15731575
static int __init cmdline_parse_movable_node(char *p)
15741576
{
1577+
#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
15751578
movable_node_enabled = true;
1579+
#else
1580+
pr_warn("movable_node parameter depends on CONFIG_HAVE_MEMBLOCK_NODE_MAP to work properly\n");
1581+
#endif
15761582
return 0;
15771583
}
15781584
early_param("movable_node", cmdline_parse_movable_node);

0 commit comments

Comments
 (0)