diff mbox series

[-next] mm/memory_hotplug: Fix build warning without CONFIG_MEMORY_HOTREMOVE

Message ID 20220408022402.29668-1-yuehaibing@huawei.com (mailing list archive)
State New
Headers show
Series [-next] mm/memory_hotplug: Fix build warning without CONFIG_MEMORY_HOTREMOVE | expand

Commit Message

Yue Haibing April 8, 2022, 2:24 a.m. UTC
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@huawei.com>
---
 mm/memory_hotplug.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
diff mbox series

Patch

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);