[PATCH -next] mm/memory_hotplug: Fix build warning without CONFIG_MEMORY_HOTREMOVE
From: YueHaibing
Date: Thu Apr 07 2022 - 22:24:44 EST
mm/memory_hotplug.c:1148:13: warning: ‘reset_node_present_pages’ defined but not used [-Wunused-function]
1148 | static void reset_node_present_pages(pg_data_t *pgdat)
| ^~~~~~~~~~~~~~~~~~~~~~~~
reset_node_present_pages() now only used in node_reset_state(),move it
inside the ifdef block to fix this warning.
Fixes: 0d540af7befe ("mm/memory_hotplug: reset node's state when empty during offline")
Signed-off-by: YueHaibing <yuehaibing@xxxxxxxxxx>
---
mm/memory_hotplug.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 74430f88853d..925359655f4d 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1145,16 +1145,6 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages,
return ret;
}
-static void reset_node_present_pages(pg_data_t *pgdat)
-{
- struct zone *z;
-
- for (z = pgdat->node_zones; z < pgdat->node_zones + MAX_NR_ZONES; z++)
- z->present_pages = 0;
-
- pgdat->node_present_pages = 0;
-}
-
static void hotadd_init_pgdat(int nid)
{
struct pglist_data *pgdat = NODE_DATA(nid);
@@ -1748,6 +1738,16 @@ static void node_states_clear_node(int node, struct memory_notify *arg)
node_clear_state(node, N_MEMORY);
}
+static void reset_node_present_pages(pg_data_t *pgdat)
+{
+ struct zone *z;
+
+ for (z = pgdat->node_zones; z < pgdat->node_zones + MAX_NR_ZONES; z++)
+ z->present_pages = 0;
+
+ pgdat->node_present_pages = 0;
+}
+
static void node_reset_state(int node)
{
pg_data_t *pgdat = NODE_DATA(node);
--
2.17.1