linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: name the anonymous MMOP enum as enum mmop
@ 2026-02-11 21:54 Gregory Price
  2026-02-11 22:18 ` Cheatham, Benjamin
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Gregory Price @ 2026-02-11 21:54 UTC (permalink / raw)
  To: linux-mm
  Cc: linux-cxl, linux-kernel, kernel-team, david, osalvador, gregkh,
	rafael, dakr, akpm, lorenzo.stoakes, Liam.Howlett, vbabka, rppt,
	surenb, mhocko, Jonathan Cameron

Give the MMOP enum (MMOP_OFFLINE, MMOP_ONLINE, etc) a proper type
name so the compiler can help catch invalid values being assigned to
variables of this type.

Leave the existing functions returning int alone to allow for
value-or-error pattern to remain unchanged without churn.

mmop_default_online_type is left as int because it uses the -1
sentinal value to signal it hasn't been initialized yet.

Keep the uint8_t buffer in offline_and_remove_memory() as-is for
space efficiency, with an explicit cast when we consume the value.

Move the enum definition before the CONFIG_MEMORY_HOTPLUG guard so
it is unconditionally available for struct memory_block in memory.h.

No functional change.

Link: https://lore.kernel.org/linux-mm/3424eba7-523b-4351-abd0-3a888a3e5e61@kernel.org/
Suggested-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Suggested-by: "David Hildenbrand (arm)" <david@kernel.org>
Signed-off-by: Gregory Price <gourry@gourry.net>
---
 drivers/base/memory.c          |  2 +-
 include/linux/memory.h         |  3 ++-
 include/linux/memory_hotplug.h | 16 ++++++++--------
 mm/memory_hotplug.c            | 10 +++++-----
 4 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 751f248ca4a8..3753ca80069d 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -452,7 +452,7 @@ static ssize_t phys_device_show(struct device *dev,
 static int print_allowed_zone(char *buf, int len, int nid,
 			      struct memory_group *group,
 			      unsigned long start_pfn, unsigned long nr_pages,
-			      int online_type, struct zone *default_zone)
+			      enum mmop online_type, struct zone *default_zone)
 {
 	struct zone *zone;
 
diff --git a/include/linux/memory.h b/include/linux/memory.h
index faeaa921e55b..5bb5599c6b2b 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -19,6 +19,7 @@
 #include <linux/node.h>
 #include <linux/compiler.h>
 #include <linux/mutex.h>
+#include <linux/memory_hotplug.h>
 
 #define MIN_MEMORY_BLOCK_SIZE     (1UL << SECTION_SIZE_BITS)
 
@@ -77,7 +78,7 @@ enum memory_block_state {
 struct memory_block {
 	unsigned long start_section_nr;
 	enum memory_block_state state;	/* serialized by the dev->lock */
-	int online_type;		/* for passing data to online routine */
+	enum mmop online_type;	/* for passing data to online routine */
 	int nid;			/* NID for this memory block */
 	/*
 	 * The single zone of this memory block if all PFNs of this memory block
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index f2f16cdd73ee..e77ef3d7ff73 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -16,11 +16,8 @@ struct resource;
 struct vmem_altmap;
 struct dev_pagemap;
 
-#ifdef CONFIG_MEMORY_HOTPLUG
-struct page *pfn_to_online_page(unsigned long pfn);
-
 /* Types for control the zone type of onlined and offlined memory */
-enum {
+enum mmop {
 	/* Offline the memory. */
 	MMOP_OFFLINE = 0,
 	/* Online the memory. Zone depends, see default_zone_for_pfn(). */
@@ -31,6 +28,9 @@ enum {
 	MMOP_ONLINE_MOVABLE,
 };
 
+#ifdef CONFIG_MEMORY_HOTPLUG
+struct page *pfn_to_online_page(unsigned long pfn);
+
 /* Flags for add_memory() and friends to specify memory hotplug details. */
 typedef int __bitwise mhp_t;
 
@@ -286,8 +286,8 @@ static inline void __remove_memory(u64 start, u64 size) {}
 
 #ifdef CONFIG_MEMORY_HOTPLUG
 /* Default online_type (MMOP_*) when new memory blocks are added. */
-extern int mhp_get_default_online_type(void);
-extern void mhp_set_default_online_type(int online_type);
+extern enum mmop mhp_get_default_online_type(void);
+extern void mhp_set_default_online_type(enum mmop online_type);
 extern void __ref free_area_init_core_hotplug(struct pglist_data *pgdat);
 extern int __add_memory(int nid, u64 start, u64 size, mhp_t mhp_flags);
 extern int add_memory(int nid, u64 start, u64 size, mhp_t mhp_flags);
@@ -310,8 +310,8 @@ extern void sparse_remove_section(unsigned long pfn, unsigned long nr_pages,
 				  struct vmem_altmap *altmap);
 extern struct page *sparse_decode_mem_map(unsigned long coded_mem_map,
 					  unsigned long pnum);
-extern struct zone *zone_for_pfn_range(int online_type, int nid,
-		struct memory_group *group, unsigned long start_pfn,
+extern struct zone *zone_for_pfn_range(enum mmop online_type,
+		int nid, struct memory_group *group, unsigned long start_pfn,
 		unsigned long nr_pages);
 extern int arch_create_linear_mapping(int nid, u64 start, u64 size,
 				      struct mhp_params *params);
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index a63ec679d861..41f48f493b8e 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -221,7 +221,7 @@ void put_online_mems(void)
 bool movable_node_enabled = false;
 
 static int mhp_default_online_type = -1;
-int mhp_get_default_online_type(void)
+enum mmop mhp_get_default_online_type(void)
 {
 	if (mhp_default_online_type >= 0)
 		return mhp_default_online_type;
@@ -240,7 +240,7 @@ int mhp_get_default_online_type(void)
 	return mhp_default_online_type;
 }
 
-void mhp_set_default_online_type(int online_type)
+void mhp_set_default_online_type(enum mmop online_type)
 {
 	mhp_default_online_type = online_type;
 }
@@ -1046,7 +1046,7 @@ static inline struct zone *default_zone_for_pfn(int nid, unsigned long start_pfn
 	return movable_node_enabled ? movable_zone : kernel_zone;
 }
 
-struct zone *zone_for_pfn_range(int online_type, int nid,
+struct zone *zone_for_pfn_range(enum mmop online_type, int nid,
 		struct memory_group *group, unsigned long start_pfn,
 		unsigned long nr_pages)
 {
@@ -2305,7 +2305,7 @@ EXPORT_SYMBOL_GPL(remove_memory);
 
 static int try_offline_memory_block(struct memory_block *mem, void *arg)
 {
-	uint8_t online_type = MMOP_ONLINE_KERNEL;
+	enum mmop online_type = MMOP_ONLINE_KERNEL;
 	uint8_t **online_types = arg;
 	struct page *page;
 	int rc;
@@ -2338,7 +2338,7 @@ static int try_reonline_memory_block(struct memory_block *mem, void *arg)
 	int rc;
 
 	if (**online_types != MMOP_OFFLINE) {
-		mem->online_type = **online_types;
+		mem->online_type = (enum mmop)**online_types;
 		rc = device_online(&mem->dev);
 		if (rc < 0)
 			pr_warn("%s: Failed to re-online memory: %d",
-- 
2.47.3



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mm: name the anonymous MMOP enum as enum mmop
  2026-02-11 21:54 [PATCH] mm: name the anonymous MMOP enum as enum mmop Gregory Price
@ 2026-02-11 22:18 ` Cheatham, Benjamin
  2026-02-12 16:33   ` Gregory Price
  2026-02-12  8:56 ` David Hildenbrand (Arm)
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Cheatham, Benjamin @ 2026-02-11 22:18 UTC (permalink / raw)
  To: Gregory Price, linux-mm
  Cc: linux-cxl, linux-kernel, kernel-team, david, osalvador, gregkh,
	rafael, dakr, akpm, lorenzo.stoakes, Liam.Howlett, vbabka, rppt,
	surenb, mhocko, Jonathan Cameron

On 2/11/2026 3:54 PM, Gregory Price wrote:
> Give the MMOP enum (MMOP_OFFLINE, MMOP_ONLINE, etc) a proper type
> name so the compiler can help catch invalid values being assigned to
> variables of this type.
> 
> Leave the existing functions returning int alone to allow for
> value-or-error pattern to remain unchanged without churn.
> 
> mmop_default_online_type is left as int because it uses the -1
> sentinal value to signal it hasn't been initialized yet.
> 
> Keep the uint8_t buffer in offline_and_remove_memory() as-is for
> space efficiency, with an explicit cast when we consume the value.
> 
> Move the enum definition before the CONFIG_MEMORY_HOTPLUG guard so
> it is unconditionally available for struct memory_block in memory.h.
> 
> No functional change.
> 
> Link: https://lore.kernel.org/linux-mm/3424eba7-523b-4351-abd0-3a888a3e5e61@kernel.org/
> Suggested-by: Jonathan Cameron <jonathan.cameron@huawei.com>
> Suggested-by: "David Hildenbrand (arm)" <david@kernel.org>
> Signed-off-by: Gregory Price <gourry@gourry.net>
> ---

I saw this when reviewing another set of yours and thought about mentioning it, glad you cleaned it up!

One small nit below, otherwise:
Reviewed-by: Ben Cheatham <benjamin.cheatham@amd.com>

>  drivers/base/memory.c          |  2 +-
>  include/linux/memory.h         |  3 ++-
>  include/linux/memory_hotplug.h | 16 ++++++++--------
>  mm/memory_hotplug.c            | 10 +++++-----
>  4 files changed, 16 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/base/memory.c b/drivers/base/memory.c
> index 751f248ca4a8..3753ca80069d 100644
> --- a/drivers/base/memory.c
> +++ b/drivers/base/memory.c
> @@ -452,7 +452,7 @@ static ssize_t phys_device_show(struct device *dev,
>  static int print_allowed_zone(char *buf, int len, int nid,
>  			      struct memory_group *group,
>  			      unsigned long start_pfn, unsigned long nr_pages,
> -			      int online_type, struct zone *default_zone)
> +			      enum mmop online_type, struct zone *default_zone)
>  {
>  	struct zone *zone;
>  
> diff --git a/include/linux/memory.h b/include/linux/memory.h
> index faeaa921e55b..5bb5599c6b2b 100644
> --- a/include/linux/memory.h
> +++ b/include/linux/memory.h
> @@ -19,6 +19,7 @@
>  #include <linux/node.h>
>  #include <linux/compiler.h>
>  #include <linux/mutex.h>
> +#include <linux/memory_hotplug.h>
>  
>  #define MIN_MEMORY_BLOCK_SIZE     (1UL << SECTION_SIZE_BITS)
>  
> @@ -77,7 +78,7 @@ enum memory_block_state {
>  struct memory_block {
>  	unsigned long start_section_nr;
>  	enum memory_block_state state;	/* serialized by the dev->lock */
> -	int online_type;		/* for passing data to online routine */
> +	enum mmop online_type;	/* for passing data to online routine */

Comment looks unaligned.

Thanks,
Ben


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mm: name the anonymous MMOP enum as enum mmop
  2026-02-11 21:54 [PATCH] mm: name the anonymous MMOP enum as enum mmop Gregory Price
  2026-02-11 22:18 ` Cheatham, Benjamin
@ 2026-02-12  8:56 ` David Hildenbrand (Arm)
  2026-02-12 16:03 ` Dave Jiang
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: David Hildenbrand (Arm) @ 2026-02-12  8:56 UTC (permalink / raw)
  To: Gregory Price, linux-mm
  Cc: linux-cxl, linux-kernel, kernel-team, osalvador, gregkh, rafael,
	dakr, akpm, lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb,
	mhocko, Jonathan Cameron

On 2/11/26 22:54, Gregory Price wrote:
> Give the MMOP enum (MMOP_OFFLINE, MMOP_ONLINE, etc) a proper type
> name so the compiler can help catch invalid values being assigned to
> variables of this type.
> 
> Leave the existing functions returning int alone to allow for
> value-or-error pattern to remain unchanged without churn.
> 
> mmop_default_online_type is left as int because it uses the -1
> sentinal value to signal it hasn't been initialized yet.
> 
> Keep the uint8_t buffer in offline_and_remove_memory() as-is for
> space efficiency, with an explicit cast when we consume the value.
> 
> Move the enum definition before the CONFIG_MEMORY_HOTPLUG guard so
> it is unconditionally available for struct memory_block in memory.h.
> 
> No functional change.
> 
> Link: https://lore.kernel.org/linux-mm/3424eba7-523b-4351-abd0-3a888a3e5e61@kernel.org/
> Suggested-by: Jonathan Cameron <jonathan.cameron@huawei.com>
> Suggested-by: "David Hildenbrand (arm)" <david@kernel.org>
> Signed-off-by: Gregory Price <gourry@gourry.net>
> ---

Acked-by: David Hildenbrand (Arm) <david@kernel.org>

-- 
Cheers,

David


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mm: name the anonymous MMOP enum as enum mmop
  2026-02-11 21:54 [PATCH] mm: name the anonymous MMOP enum as enum mmop Gregory Price
  2026-02-11 22:18 ` Cheatham, Benjamin
  2026-02-12  8:56 ` David Hildenbrand (Arm)
@ 2026-02-12 16:03 ` Dave Jiang
  2026-02-12 18:13 ` Davidlohr Bueso
  2026-02-19 11:18 ` Jonathan Cameron
  4 siblings, 0 replies; 7+ messages in thread
From: Dave Jiang @ 2026-02-12 16:03 UTC (permalink / raw)
  To: Gregory Price, linux-mm
  Cc: linux-cxl, linux-kernel, kernel-team, david, osalvador, gregkh,
	rafael, dakr, akpm, lorenzo.stoakes, Liam.Howlett, vbabka, rppt,
	surenb, mhocko, Jonathan Cameron



On 2/11/26 2:54 PM, Gregory Price wrote:
> Give the MMOP enum (MMOP_OFFLINE, MMOP_ONLINE, etc) a proper type
> name so the compiler can help catch invalid values being assigned to
> variables of this type.
> 
> Leave the existing functions returning int alone to allow for
> value-or-error pattern to remain unchanged without churn.
> 
> mmop_default_online_type is left as int because it uses the -1
> sentinal value to signal it hasn't been initialized yet.
> 
> Keep the uint8_t buffer in offline_and_remove_memory() as-is for
> space efficiency, with an explicit cast when we consume the value.
> 
> Move the enum definition before the CONFIG_MEMORY_HOTPLUG guard so
> it is unconditionally available for struct memory_block in memory.h.
> 
> No functional change.
> 
> Link: https://lore.kernel.org/linux-mm/3424eba7-523b-4351-abd0-3a888a3e5e61@kernel.org/
> Suggested-by: Jonathan Cameron <jonathan.cameron@huawei.com>
> Suggested-by: "David Hildenbrand (arm)" <david@kernel.org>
> Signed-off-by: Gregory Price <gourry@gourry.net>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>

> ---
>  drivers/base/memory.c          |  2 +-
>  include/linux/memory.h         |  3 ++-
>  include/linux/memory_hotplug.h | 16 ++++++++--------
>  mm/memory_hotplug.c            | 10 +++++-----
>  4 files changed, 16 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/base/memory.c b/drivers/base/memory.c
> index 751f248ca4a8..3753ca80069d 100644
> --- a/drivers/base/memory.c
> +++ b/drivers/base/memory.c
> @@ -452,7 +452,7 @@ static ssize_t phys_device_show(struct device *dev,
>  static int print_allowed_zone(char *buf, int len, int nid,
>  			      struct memory_group *group,
>  			      unsigned long start_pfn, unsigned long nr_pages,
> -			      int online_type, struct zone *default_zone)
> +			      enum mmop online_type, struct zone *default_zone)
>  {
>  	struct zone *zone;
>  
> diff --git a/include/linux/memory.h b/include/linux/memory.h
> index faeaa921e55b..5bb5599c6b2b 100644
> --- a/include/linux/memory.h
> +++ b/include/linux/memory.h
> @@ -19,6 +19,7 @@
>  #include <linux/node.h>
>  #include <linux/compiler.h>
>  #include <linux/mutex.h>
> +#include <linux/memory_hotplug.h>
>  
>  #define MIN_MEMORY_BLOCK_SIZE     (1UL << SECTION_SIZE_BITS)
>  
> @@ -77,7 +78,7 @@ enum memory_block_state {
>  struct memory_block {
>  	unsigned long start_section_nr;
>  	enum memory_block_state state;	/* serialized by the dev->lock */
> -	int online_type;		/* for passing data to online routine */
> +	enum mmop online_type;	/* for passing data to online routine */
>  	int nid;			/* NID for this memory block */
>  	/*
>  	 * The single zone of this memory block if all PFNs of this memory block
> diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
> index f2f16cdd73ee..e77ef3d7ff73 100644
> --- a/include/linux/memory_hotplug.h
> +++ b/include/linux/memory_hotplug.h
> @@ -16,11 +16,8 @@ struct resource;
>  struct vmem_altmap;
>  struct dev_pagemap;
>  
> -#ifdef CONFIG_MEMORY_HOTPLUG
> -struct page *pfn_to_online_page(unsigned long pfn);
> -
>  /* Types for control the zone type of onlined and offlined memory */
> -enum {
> +enum mmop {
>  	/* Offline the memory. */
>  	MMOP_OFFLINE = 0,
>  	/* Online the memory. Zone depends, see default_zone_for_pfn(). */
> @@ -31,6 +28,9 @@ enum {
>  	MMOP_ONLINE_MOVABLE,
>  };
>  
> +#ifdef CONFIG_MEMORY_HOTPLUG
> +struct page *pfn_to_online_page(unsigned long pfn);
> +
>  /* Flags for add_memory() and friends to specify memory hotplug details. */
>  typedef int __bitwise mhp_t;
>  
> @@ -286,8 +286,8 @@ static inline void __remove_memory(u64 start, u64 size) {}
>  
>  #ifdef CONFIG_MEMORY_HOTPLUG
>  /* Default online_type (MMOP_*) when new memory blocks are added. */
> -extern int mhp_get_default_online_type(void);
> -extern void mhp_set_default_online_type(int online_type);
> +extern enum mmop mhp_get_default_online_type(void);
> +extern void mhp_set_default_online_type(enum mmop online_type);
>  extern void __ref free_area_init_core_hotplug(struct pglist_data *pgdat);
>  extern int __add_memory(int nid, u64 start, u64 size, mhp_t mhp_flags);
>  extern int add_memory(int nid, u64 start, u64 size, mhp_t mhp_flags);
> @@ -310,8 +310,8 @@ extern void sparse_remove_section(unsigned long pfn, unsigned long nr_pages,
>  				  struct vmem_altmap *altmap);
>  extern struct page *sparse_decode_mem_map(unsigned long coded_mem_map,
>  					  unsigned long pnum);
> -extern struct zone *zone_for_pfn_range(int online_type, int nid,
> -		struct memory_group *group, unsigned long start_pfn,
> +extern struct zone *zone_for_pfn_range(enum mmop online_type,
> +		int nid, struct memory_group *group, unsigned long start_pfn,
>  		unsigned long nr_pages);
>  extern int arch_create_linear_mapping(int nid, u64 start, u64 size,
>  				      struct mhp_params *params);
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index a63ec679d861..41f48f493b8e 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -221,7 +221,7 @@ void put_online_mems(void)
>  bool movable_node_enabled = false;
>  
>  static int mhp_default_online_type = -1;
> -int mhp_get_default_online_type(void)
> +enum mmop mhp_get_default_online_type(void)
>  {
>  	if (mhp_default_online_type >= 0)
>  		return mhp_default_online_type;
> @@ -240,7 +240,7 @@ int mhp_get_default_online_type(void)
>  	return mhp_default_online_type;
>  }
>  
> -void mhp_set_default_online_type(int online_type)
> +void mhp_set_default_online_type(enum mmop online_type)
>  {
>  	mhp_default_online_type = online_type;
>  }
> @@ -1046,7 +1046,7 @@ static inline struct zone *default_zone_for_pfn(int nid, unsigned long start_pfn
>  	return movable_node_enabled ? movable_zone : kernel_zone;
>  }
>  
> -struct zone *zone_for_pfn_range(int online_type, int nid,
> +struct zone *zone_for_pfn_range(enum mmop online_type, int nid,
>  		struct memory_group *group, unsigned long start_pfn,
>  		unsigned long nr_pages)
>  {
> @@ -2305,7 +2305,7 @@ EXPORT_SYMBOL_GPL(remove_memory);
>  
>  static int try_offline_memory_block(struct memory_block *mem, void *arg)
>  {
> -	uint8_t online_type = MMOP_ONLINE_KERNEL;
> +	enum mmop online_type = MMOP_ONLINE_KERNEL;
>  	uint8_t **online_types = arg;
>  	struct page *page;
>  	int rc;
> @@ -2338,7 +2338,7 @@ static int try_reonline_memory_block(struct memory_block *mem, void *arg)
>  	int rc;
>  
>  	if (**online_types != MMOP_OFFLINE) {
> -		mem->online_type = **online_types;
> +		mem->online_type = (enum mmop)**online_types;
>  		rc = device_online(&mem->dev);
>  		if (rc < 0)
>  			pr_warn("%s: Failed to re-online memory: %d",



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mm: name the anonymous MMOP enum as enum mmop
  2026-02-11 22:18 ` Cheatham, Benjamin
@ 2026-02-12 16:33   ` Gregory Price
  0 siblings, 0 replies; 7+ messages in thread
From: Gregory Price @ 2026-02-12 16:33 UTC (permalink / raw)
  To: Cheatham, Benjamin
  Cc: linux-mm, linux-cxl, linux-kernel, kernel-team, david, osalvador,
	gregkh, rafael, dakr, akpm, lorenzo.stoakes, Liam.Howlett,
	vbabka, rppt, surenb, mhocko, Jonathan Cameron

On Wed, Feb 11, 2026 at 04:18:45PM -0600, Cheatham, Benjamin wrote:
> On 2/11/2026 3:54 PM, Gregory Price wrote:
> >  
> > @@ -77,7 +78,7 @@ enum memory_block_state {
> >  struct memory_block {
> >  	unsigned long start_section_nr;
> >  	enum memory_block_state state;	/* serialized by the dev->lock */
> > -	int online_type;		/* for passing data to online routine */
> > +	enum mmop online_type;	/* for passing data to online routine */
> 
> Comment looks unaligned.
> 

Ah yeah was already unaligned. Bleh.

Probably not worth a full v2 unless Andrew prefers that.

~Gregory


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mm: name the anonymous MMOP enum as enum mmop
  2026-02-11 21:54 [PATCH] mm: name the anonymous MMOP enum as enum mmop Gregory Price
                   ` (2 preceding siblings ...)
  2026-02-12 16:03 ` Dave Jiang
@ 2026-02-12 18:13 ` Davidlohr Bueso
  2026-02-19 11:18 ` Jonathan Cameron
  4 siblings, 0 replies; 7+ messages in thread
From: Davidlohr Bueso @ 2026-02-12 18:13 UTC (permalink / raw)
  To: Gregory Price
  Cc: linux-mm, linux-cxl, linux-kernel, kernel-team, david, osalvador,
	gregkh, rafael, dakr, akpm, lorenzo.stoakes, Liam.Howlett,
	vbabka, rppt, surenb, mhocko, Jonathan Cameron

On Wed, 11 Feb 2026, Gregory Price wrote:

>Give the MMOP enum (MMOP_OFFLINE, MMOP_ONLINE, etc) a proper type
>name so the compiler can help catch invalid values being assigned to
>variables of this type.
>
>Leave the existing functions returning int alone to allow for
>value-or-error pattern to remain unchanged without churn.
>
>mmop_default_online_type is left as int because it uses the -1
>sentinal value to signal it hasn't been initialized yet.
>
>Keep the uint8_t buffer in offline_and_remove_memory() as-is for
>space efficiency, with an explicit cast when we consume the value.
>
>Move the enum definition before the CONFIG_MEMORY_HOTPLUG guard so
>it is unconditionally available for struct memory_block in memory.h.
>
>No functional change.

Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mm: name the anonymous MMOP enum as enum mmop
  2026-02-11 21:54 [PATCH] mm: name the anonymous MMOP enum as enum mmop Gregory Price
                   ` (3 preceding siblings ...)
  2026-02-12 18:13 ` Davidlohr Bueso
@ 2026-02-19 11:18 ` Jonathan Cameron
  4 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2026-02-19 11:18 UTC (permalink / raw)
  To: Gregory Price
  Cc: linux-mm, linux-cxl, linux-kernel, kernel-team, david, osalvador,
	gregkh, rafael, dakr, akpm, lorenzo.stoakes, Liam.Howlett,
	vbabka, rppt, surenb, mhocko

On Wed, 11 Feb 2026 16:54:47 -0500
Gregory Price <gourry@gourry.net> wrote:

> Give the MMOP enum (MMOP_OFFLINE, MMOP_ONLINE, etc) a proper type
> name so the compiler can help catch invalid values being assigned to
> variables of this type.
> 
> Leave the existing functions returning int alone to allow for
> value-or-error pattern to remain unchanged without churn.
> 
> mmop_default_online_type is left as int because it uses the -1
> sentinal value to signal it hasn't been initialized yet.
> 
> Keep the uint8_t buffer in offline_and_remove_memory() as-is for
> space efficiency, with an explicit cast when we consume the value.
> 
> Move the enum definition before the CONFIG_MEMORY_HOTPLUG guard so
> it is unconditionally available for struct memory_block in memory.h.
> 
> No functional change.
> 
> Link: https://lore.kernel.org/linux-mm/3424eba7-523b-4351-abd0-3a888a3e5e61@kernel.org/
> Suggested-by: Jonathan Cameron <jonathan.cameron@huawei.com>
> Suggested-by: "David Hildenbrand (arm)" <david@kernel.org>
> Signed-off-by: Gregory Price <gourry@gourry.net>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>

Thanks for cleaning this up!

J



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-02-19 11:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-11 21:54 [PATCH] mm: name the anonymous MMOP enum as enum mmop Gregory Price
2026-02-11 22:18 ` Cheatham, Benjamin
2026-02-12 16:33   ` Gregory Price
2026-02-12  8:56 ` David Hildenbrand (Arm)
2026-02-12 16:03 ` Dave Jiang
2026-02-12 18:13 ` Davidlohr Bueso
2026-02-19 11:18 ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox