[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <35db57ae-64cd-40ed-8353-7d3b64069471@amd.com>
Date: Wed, 11 Feb 2026 16:18:45 -0600
From: "Cheatham, Benjamin" <benjamin.cheatham@....com>
To: Gregory Price <gourry@...rry.net>, <linux-mm@...ck.org>
CC: <linux-cxl@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<kernel-team@...a.com>, <david@...nel.org>, <osalvador@...e.de>,
<gregkh@...uxfoundation.org>, <rafael@...nel.org>, <dakr@...nel.org>,
<akpm@...ux-foundation.org>, <lorenzo.stoakes@...cle.com>,
<Liam.Howlett@...cle.com>, <vbabka@...e.cz>, <rppt@...nel.org>,
<surenb@...gle.com>, <mhocko@...e.com>, Jonathan Cameron
<jonathan.cameron@...wei.com>
Subject: Re: [PATCH] mm: name the anonymous MMOP enum as enum mmop
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@...wei.com>
> Suggested-by: "David Hildenbrand (arm)" <david@...nel.org>
> Signed-off-by: Gregory Price <gourry@...rry.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@....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
Powered by blists - more mailing lists