Message ID | 20200319131221.14044-8-david@redhat.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | [v3,1/8] drivers/base/memory: rename MMOP_ONLINE_KEEP to MMOP_ONLINE | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | warning | Failed to apply on branch powerpc/merge (8a445cbcb9f5090cb07ec6cbb89a8a1fc99a0ff7) |
snowpatch_ozlabs/apply_patch | warning | Failed to apply on branch powerpc/next (59ed2adf393109c56d383e568f2e57bb5ad6d901) |
snowpatch_ozlabs/apply_patch | warning | Failed to apply on branch linus/master (5076190daded2197f62fe92cf69674488be44175) |
snowpatch_ozlabs/apply_patch | warning | Failed to apply on branch powerpc/fixes (af3d0a68698c7e5df8b72267086b23422a3954bb) |
snowpatch_ozlabs/apply_patch | warning | Failed to apply on branch linux-next (aff7e57f8266549245eb4a272ce149b752dfce77) |
snowpatch_ozlabs/apply_patch | fail | Failed to apply to any branch |
> ... and rename it to memhp_default_online_type. This is a preparation > for more detailed default online behavior. > > Reviewed-by: Wei Yang <richard.weiyang@gmail.com> > Acked-by: Michal Hocko <mhocko@suse.com> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Cc: Andrew Morton <akpm@linux-foundation.org> > Cc: Michal Hocko <mhocko@kernel.org> > Cc: Oscar Salvador <osalvador@suse.de> > Cc: "Rafael J. Wysocki" <rafael@kernel.org> > Cc: Baoquan He <bhe@redhat.com> > Cc: Wei Yang <richard.weiyang@gmail.com> > Signed-off-by: David Hildenbrand <david@redhat.com> > --- > drivers/base/memory.c | 10 ++++------ > include/linux/memory_hotplug.h | 3 ++- > mm/memory_hotplug.c | 11 ++++++----- > 3 files changed, 12 insertions(+), 12 deletions(-) > > diff --git a/drivers/base/memory.c b/drivers/base/memory.c > index 8a7f29c0bf97..8d3e16dab69f 100644 > --- a/drivers/base/memory.c > +++ b/drivers/base/memory.c > @@ -386,10 +386,8 @@ static DEVICE_ATTR_RO(block_size_bytes); > static ssize_t auto_online_blocks_show(struct device *dev, > struct device_attribute *attr, char *buf) > { > - if (memhp_auto_online) > - return sprintf(buf, "online\n"); > - else > - return sprintf(buf, "offline\n"); > + return sprintf(buf, "%s\n", > + online_type_to_str[memhp_default_online_type]); > } > > static ssize_t auto_online_blocks_store(struct device *dev, > @@ -397,9 +395,9 @@ static ssize_t auto_online_blocks_store(struct device *dev, > const char *buf, size_t count) > { > if (sysfs_streq(buf, "online")) > - memhp_auto_online = true; > + memhp_default_online_type = MMOP_ONLINE; > else if (sysfs_streq(buf, "offline")) > - memhp_auto_online = false; > + memhp_default_online_type = MMOP_OFFLINE; > else > return -EINVAL; > > diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h > index 76f3c617a8ab..6d6f85bb66e9 100644 > --- a/include/linux/memory_hotplug.h > +++ b/include/linux/memory_hotplug.h > @@ -118,7 +118,8 @@ extern int arch_add_memory(int nid, u64 start, u64 size, > struct mhp_params *params); > extern u64 max_mem_size; > > -extern bool memhp_auto_online; > +/* Default online_type (MMOP_*) when new memory blocks are added. */ > +extern int memhp_default_online_type; > /* If movable_node boot option specified */ > extern bool movable_node_enabled; > static inline bool movable_node_is_enabled(void) > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > index e21a7d53ade5..4efcf8cb9ac5 100644 > --- a/mm/memory_hotplug.c > +++ b/mm/memory_hotplug.c > @@ -67,17 +67,17 @@ void put_online_mems(void) > bool movable_node_enabled = false; > > #ifndef CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE > -bool memhp_auto_online; > +int memhp_default_online_type = MMOP_OFFLINE; > #else > -bool memhp_auto_online = true; > +int memhp_default_online_type = MMOP_ONLINE; > #endif > > static int __init setup_memhp_default_state(char *str) > { > if (!strcmp(str, "online")) > - memhp_auto_online = true; > + memhp_default_online_type = MMOP_ONLINE; > else if (!strcmp(str, "offline")) > - memhp_auto_online = false; > + memhp_default_online_type = MMOP_OFFLINE; > > return 1; > } > @@ -993,6 +993,7 @@ static int check_hotplug_memory_range(u64 start, u64 size) > > static int online_memory_block(struct memory_block *mem, void *arg) > { > + mem->online_type = memhp_default_online_type; > return device_online(&mem->dev); > } > > @@ -1065,7 +1066,7 @@ int __ref add_memory_resource(int nid, struct resource *res) > mem_hotplug_done(); > > /* online pages if requested */ > - if (memhp_auto_online) > + if (memhp_default_online_type != MMOP_OFFLINE) > walk_memory_blocks(start, size, NULL, online_memory_block); > > return ret; > -- Acked-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com> > 2.24.1 > >
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 8a7f29c0bf97..8d3e16dab69f 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -386,10 +386,8 @@ static DEVICE_ATTR_RO(block_size_bytes); static ssize_t auto_online_blocks_show(struct device *dev, struct device_attribute *attr, char *buf) { - if (memhp_auto_online) - return sprintf(buf, "online\n"); - else - return sprintf(buf, "offline\n"); + return sprintf(buf, "%s\n", + online_type_to_str[memhp_default_online_type]); } static ssize_t auto_online_blocks_store(struct device *dev, @@ -397,9 +395,9 @@ static ssize_t auto_online_blocks_store(struct device *dev, const char *buf, size_t count) { if (sysfs_streq(buf, "online")) - memhp_auto_online = true; + memhp_default_online_type = MMOP_ONLINE; else if (sysfs_streq(buf, "offline")) - memhp_auto_online = false; + memhp_default_online_type = MMOP_OFFLINE; else return -EINVAL; diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index 76f3c617a8ab..6d6f85bb66e9 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -118,7 +118,8 @@ extern int arch_add_memory(int nid, u64 start, u64 size, struct mhp_params *params); extern u64 max_mem_size; -extern bool memhp_auto_online; +/* Default online_type (MMOP_*) when new memory blocks are added. */ +extern int memhp_default_online_type; /* If movable_node boot option specified */ extern bool movable_node_enabled; static inline bool movable_node_is_enabled(void) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index e21a7d53ade5..4efcf8cb9ac5 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -67,17 +67,17 @@ void put_online_mems(void) bool movable_node_enabled = false; #ifndef CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE -bool memhp_auto_online; +int memhp_default_online_type = MMOP_OFFLINE; #else -bool memhp_auto_online = true; +int memhp_default_online_type = MMOP_ONLINE; #endif static int __init setup_memhp_default_state(char *str) { if (!strcmp(str, "online")) - memhp_auto_online = true; + memhp_default_online_type = MMOP_ONLINE; else if (!strcmp(str, "offline")) - memhp_auto_online = false; + memhp_default_online_type = MMOP_OFFLINE; return 1; } @@ -993,6 +993,7 @@ static int check_hotplug_memory_range(u64 start, u64 size) static int online_memory_block(struct memory_block *mem, void *arg) { + mem->online_type = memhp_default_online_type; return device_online(&mem->dev); } @@ -1065,7 +1066,7 @@ int __ref add_memory_resource(int nid, struct resource *res) mem_hotplug_done(); /* online pages if requested */ - if (memhp_auto_online) + if (memhp_default_online_type != MMOP_OFFLINE) walk_memory_blocks(start, size, NULL, online_memory_block); return ret;