Skip to content

Commit

Permalink
mm/memory_hotplug: rename all existing 'memhp' into 'mhp'
Browse files Browse the repository at this point in the history
This renames all 'memhp' instances to 'mhp' except for memhp_default_state
for being a kernel command line option.  This is just a clean up and
should not cause a functional change.  Let's make it consistent rater than
mixing the two prefixes.  In preparation for more users of the 'mhp'
terminology.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Anshuman Khandual <[email protected]>
Suggested-by: David Hildenbrand <[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Anshuman Khandual authored and torvalds committed Feb 26, 2021
1 parent 34dc45b commit 1adf8b4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions drivers/base/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static const char *const online_type_to_str[] = {
[MMOP_ONLINE_MOVABLE] = "online_movable",
};

int memhp_online_type_from_str(const char *str)
int mhp_online_type_from_str(const char *str)
{
int i;

Expand Down Expand Up @@ -253,7 +253,7 @@ static int memory_subsys_offline(struct device *dev)
static ssize_t state_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
const int online_type = memhp_online_type_from_str(buf);
const int online_type = mhp_online_type_from_str(buf);
struct memory_block *mem = to_memory_block(dev);
int ret;

Expand Down Expand Up @@ -387,19 +387,19 @@ static ssize_t auto_online_blocks_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
return sysfs_emit(buf, "%s\n",
online_type_to_str[memhp_default_online_type]);
online_type_to_str[mhp_default_online_type]);
}

static ssize_t auto_online_blocks_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
const int online_type = memhp_online_type_from_str(buf);
const int online_type = mhp_online_type_from_str(buf);

if (online_type < 0)
return -EINVAL;

memhp_default_online_type = online_type;
mhp_default_online_type = online_type;
return count;
}

Expand Down
4 changes: 2 additions & 2 deletions include/linux/memory_hotplug.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ extern int arch_add_memory(int nid, u64 start, u64 size,
struct mhp_params *params);
extern u64 max_mem_size;

extern int memhp_online_type_from_str(const char *str);
extern int mhp_online_type_from_str(const char *str);

/* Default online_type (MMOP_*) when new memory blocks are added. */
extern int memhp_default_online_type;
extern int mhp_default_online_type;
/* If movable_node boot option specified */
extern bool movable_node_enabled;
static inline bool movable_node_is_enabled(void)
Expand Down
12 changes: 6 additions & 6 deletions mm/memory_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ void put_online_mems(void)
bool movable_node_enabled = false;

#ifndef CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE
int memhp_default_online_type = MMOP_OFFLINE;
int mhp_default_online_type = MMOP_OFFLINE;
#else
int memhp_default_online_type = MMOP_ONLINE;
int mhp_default_online_type = MMOP_ONLINE;
#endif

static int __init setup_memhp_default_state(char *str)
{
const int online_type = memhp_online_type_from_str(str);
const int online_type = mhp_online_type_from_str(str);

if (online_type >= 0)
memhp_default_online_type = online_type;
mhp_default_online_type = online_type;

return 1;
}
Expand Down Expand Up @@ -1076,7 +1076,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;
mem->online_type = mhp_default_online_type;
return device_online(&mem->dev);
}

Expand Down Expand Up @@ -1157,7 +1157,7 @@ int __ref add_memory_resource(int nid, struct resource *res, mhp_t mhp_flags)
merge_system_ram_resource(res);

/* online pages if requested */
if (memhp_default_online_type != MMOP_OFFLINE)
if (mhp_default_online_type != MMOP_OFFLINE)
walk_memory_blocks(start, size, NULL, online_memory_block);

return ret;
Expand Down

0 comments on commit 1adf8b4

Please sign in to comment.