From: Oscar Salvador <osalvador@suse.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: David Hildenbrand <david@redhat.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Vlastimil Babka <vbabka@suse.cz>,
Hyeonggon Yoo <42.hyeyoo@gmail.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Rakie Kim <rakie.kim@sk.com>, Oscar Salvador <osalvador@suse.de>,
Harry Yoo <harry.yoo@oracle.com>
Subject: [PATCH v3 3/3] mm,memory_hotplug: Rename status_change_nid parameter in memory_notify
Date: Fri, 2 May 2025 10:36:24 +0200 [thread overview]
Message-ID: <20250502083624.49849-4-osalvador@suse.de> (raw)
In-Reply-To: <20250502083624.49849-1-osalvador@suse.de>
The 'status_change_nid' field was used to track changes in the memory
state of a numa node, but that funcionality has been decoupled from
memory_notify and moved to node_notify.
Current consumers of memory_notify are only interested in which node the
memory we are adding belongs to, so rename current 'status_change_nid'
to 'nid'.
Signed-off-by: Oscar Salvador <osalvador@suse.de>
Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
---
include/linux/memory.h | 2 +-
mm/memory_hotplug.c | 4 ++--
mm/page_ext.c | 12 +-----------
3 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 8c5c88eaffb3..3c482f189d14 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -117,7 +117,7 @@ struct memory_notify {
unsigned long altmap_nr_pages;
unsigned long start_pfn;
unsigned long nr_pages;
- int status_change_nid;
+ int nid;
};
struct node_notify {
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 777f98326908..9b57b58e88bc 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1192,6 +1192,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages,
mem_arg.start_pfn = pfn;
mem_arg.nr_pages = nr_pages;
+ mem_arg.nid = nid;
node_states_check_changes_online(nr_pages, zone, &node_arg);
if (node_arg.status_change_nid >= 0) {
@@ -1204,7 +1205,6 @@ int online_pages(unsigned long pfn, unsigned long nr_pages,
}
cancel_mem_notifier_on_err = true;
- mem_arg.status_change_nid = node_arg.status_change_nid;
ret = memory_notify(MEM_GOING_ONLINE, &mem_arg);
ret = notifier_to_errno(ret);
if (ret)
@@ -2014,6 +2014,7 @@ int offline_pages(unsigned long start_pfn, unsigned long nr_pages,
mem_arg.start_pfn = start_pfn;
mem_arg.nr_pages = nr_pages;
+ mem_arg.nid = node;
node_states_check_changes_offline(nr_pages, zone, &node_arg);
if (node_arg.status_change_nid >= 0) {
@@ -2025,7 +2026,6 @@ int offline_pages(unsigned long start_pfn, unsigned long nr_pages,
}
cancel_mem_notifier_on_err = true;
- mem_arg.status_change_nid = node_arg.status_change_nid;
ret = memory_notify(MEM_GOING_OFFLINE, &mem_arg);
ret = notifier_to_errno(ret);
if (ret) {
diff --git a/mm/page_ext.c b/mm/page_ext.c
index c351fdfe9e9a..477e6f24b7ab 100644
--- a/mm/page_ext.c
+++ b/mm/page_ext.c
@@ -378,16 +378,6 @@ static int __meminit online_page_ext(unsigned long start_pfn,
start = SECTION_ALIGN_DOWN(start_pfn);
end = SECTION_ALIGN_UP(start_pfn + nr_pages);
- if (nid == NUMA_NO_NODE) {
- /*
- * In this case, "nid" already exists and contains valid memory.
- * "start_pfn" passed to us is a pfn which is an arg for
- * online__pages(), and start_pfn should exist.
- */
- nid = pfn_to_nid(start_pfn);
- VM_BUG_ON(!node_online(nid));
- }
-
for (pfn = start; !fail && pfn < end; pfn += PAGES_PER_SECTION)
fail = init_section_page_ext(pfn, nid);
if (!fail)
@@ -436,7 +426,7 @@ static int __meminit page_ext_callback(struct notifier_block *self,
switch (action) {
case MEM_GOING_ONLINE:
ret = online_page_ext(mn->start_pfn,
- mn->nr_pages, mn->status_change_nid);
+ mn->nr_pages, mn->nid);
break;
case MEM_OFFLINE:
offline_page_ext(mn->start_pfn,
--
2.49.0
next prev parent reply other threads:[~2025-05-02 8:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-02 8:36 [PATCH v3 0/3] Implement numa node notifier Oscar Salvador
2025-05-02 8:36 ` [PATCH v3 1/3] mm,slub: Do not special case N_NORMAL nodes for slab_nodes Oscar Salvador
2025-05-05 13:43 ` Vlastimil Babka
2025-05-02 8:36 ` [PATCH v3 2/3] mm,memory_hotplug: Implement numa node notifier Oscar Salvador
2025-05-02 15:28 ` Gregory Price
2025-05-05 14:51 ` Dan Carpenter
2025-05-28 2:23 ` Honggyu Kim
2025-06-03 9:14 ` Oscar Salvador
2025-05-02 19:09 ` ALOK TIWARI
2025-05-05 13:58 ` Vlastimil Babka
2025-05-02 8:36 ` Oscar Salvador [this message]
2025-05-02 19:15 ` [PATCH v3 3/3] mm,memory_hotplug: Rename status_change_nid parameter in memory_notify ALOK TIWARI
2025-05-04 3:03 ` [PATCH v3 0/3] Implement numa node notifier Andrew Morton
2025-05-04 5:44 ` Oscar Salvador
2025-05-04 6:16 ` Andrew Morton
2025-05-05 17:07 ` Gregory Price
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250502083624.49849-4-osalvador@suse.de \
--to=osalvador@suse.de \
--cc=42.hyeyoo@gmail.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=harry.yoo@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rakie.kim@sk.com \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox