diff mbox series

mm/memory_hotplug: Rename all existing 'memhp' into 'mhp'

Message ID 1611554093-27316-1-git-send-email-anshuman.khandual@arm.com (mailing list archive)
State New, archived
Headers show
Series mm/memory_hotplug: Rename all existing 'memhp' into 'mhp' | expand

Commit Message

Anshuman Khandual Jan. 25, 2021, 5:54 a.m. UTC
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.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Suggested-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
During hotplug arch callback series, it was proposed to convert all the
remaining 'memhp' into 'mhp' instead.

https://lore.kernel.org/linux-mm/c37de2d0-28a1-4f7d-f944-cfd7d81c334d@redhat.com/

This applies on v5.11-rc5. After this change, 'memhp' is only mentioned
for 'memhp_default_state' kernel command line paramater and its related
function. A tree wide search gives the following result.

$git grep memhp

Documentation/admin-guide/kernel-parameters.txt:        memhp_default_state=online/offline
mm/memory_hotplug.c:static int __init setup_memhp_default_state(char *str)
mm/memory_hotplug.c:__setup("memhp_default_state=", setup_memhp_default_state);

 drivers/base/memory.c          | 10 +++++-----
 include/linux/memory_hotplug.h |  4 ++--
 mm/memory_hotplug.c            | 12 ++++++------
 3 files changed, 13 insertions(+), 13 deletions(-)

Comments

Greg KH Jan. 25, 2021, 8:26 a.m. UTC | #1
On Mon, Jan 25, 2021 at 11:24:53AM +0530, Anshuman Khandual wrote:
> 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.

THat says _what_ you are doing, but I have no idea _why_ this is needed
for anything...

thanks,

greg k-h
Anshuman Khandual Jan. 25, 2021, 8:51 a.m. UTC | #2
On 1/25/21 1:56 PM, Greg Kroah-Hartman wrote:
> On Mon, Jan 25, 2021 at 11:24:53AM +0530, Anshuman Khandual wrote:
>> 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.
> 
> THat says _what_ you are doing, but I have no idea _why_ this is needed
> for anything...

There is a series [1] which adds some new hotplug functions starting
with mhp_ (after deciding in its favor rather than memhp_). We should
have a common naming scheme either memhp_ based or mhp_ based but not
mixed. As it was proposed [2] to go with mhp_ based names instead, all
the existing memhp_ needed renaming. Hence the this patch.

[1] https://lore.kernel.org/linux-mm/1611543532-18698-1-git-send-email-anshuman.khandual@arm.com/
[2] https://lore.kernel.org/linux-mm/c37de2d0-28a1-4f7d-f944-cfd7d81c334d@redhat.com/

- Anshuman
David Hildenbrand Jan. 25, 2021, 8:54 a.m. UTC | #3
On 25.01.21 09:26, Greg Kroah-Hartman wrote:
> On Mon, Jan 25, 2021 at 11:24:53AM +0530, Anshuman Khandual wrote:
>> 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.
> 
> THat says _what_ you are doing, but I have no idea _why_ this is needed
> for anything...
> 

Let's add something like

"Let's make it consistent, especially preparing for more users of the
'mhp' terminology."


Reviewed-by: David Hildenbrand <david@redhat.com>
Greg KH Jan. 25, 2021, 9:25 a.m. UTC | #4
On Mon, Jan 25, 2021 at 02:21:02PM +0530, Anshuman Khandual wrote:
> 
> 
> On 1/25/21 1:56 PM, Greg Kroah-Hartman wrote:
> > On Mon, Jan 25, 2021 at 11:24:53AM +0530, Anshuman Khandual wrote:
> >> 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.
> > 
> > THat says _what_ you are doing, but I have no idea _why_ this is needed
> > for anything...
> 
> There is a series [1] which adds some new hotplug functions starting
> with mhp_ (after deciding in its favor rather than memhp_). We should
> have a common naming scheme either memhp_ based or mhp_ based but not
> mixed. As it was proposed [2] to go with mhp_ based names instead, all
> the existing memhp_ needed renaming. Hence the this patch.

And how was I supposed to know any of this by reading the changelog
text?  (hint, it needs to go in there...)

thanks,

greg k-h
diff mbox series

Patch

diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index f0303c8b4f14..8c7a5818fea9 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -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;
 
@@ -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;
 
@@ -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;
 }
 
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index e4c80561e519..e0cc6bc1e948 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -134,10 +134,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)
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index fb734a865807..5e35e4024785 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
-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;
 }
@@ -992,7 +992,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);
 }
 
@@ -1073,7 +1073,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;