mm/vmstat: move pgdemote_* out of CONFIG_NUMA_BALANCING
authorLi Zhijian <lizhijian@fujitsu.com>
Fri, 29 Dec 2023 02:26:51 +0000 (10:26 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 5 Jan 2024 18:17:47 +0000 (10:17 -0800)
Demotion can work well without CONFIG_NUMA_BALANCING.  But the commit
23e9f0138963 ("mm/vmstat: move pgdemote_* to per-node stats") wrongly hid
it behind CONFIG_NUMA_BALANCING.

Fix it by moving them out of CONFIG_NUMA_BALANCING.

Link: https://lkml.kernel.org/r/20231229022651.3229174-1-lizhijian@fujitsu.com
Fixes: 23e9f0138963 ("mm/vmstat: move pgdemote_* to per-node stats")
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
Cc: "Huang, Ying" <ying.huang@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/mmzone.h
mm/vmscan.c
mm/vmstat.c

index 28665e1b84754647102ef426f1f92fc8c9a22108..c18c53353b50f0152deebc22d95aab24f465e72a 100644 (file)
@@ -207,11 +207,11 @@ enum node_stat_item {
 #ifdef CONFIG_NUMA_BALANCING
        PGPROMOTE_SUCCESS,      /* promote successfully */
        PGPROMOTE_CANDIDATE,    /* candidate pages to promote */
+#endif
        /* PGDEMOTE_*: pages demoted */
        PGDEMOTE_KSWAPD,
        PGDEMOTE_DIRECT,
        PGDEMOTE_KHUGEPAGED,
-#endif
        NR_VM_NODE_STAT_ITEMS
 };
 
index ceba905e56305d0759ae7cf479e4112c6bc2a4fa..600ed3cbf7cb3e0c825f2805fc23b856873bde26 100644 (file)
@@ -409,12 +409,10 @@ void drop_slab(void)
 
 static int reclaimer_offset(void)
 {
-#ifdef CONFIG_NUMA_BALANCING
        BUILD_BUG_ON(PGSTEAL_DIRECT - PGSTEAL_KSWAPD !=
                        PGDEMOTE_DIRECT - PGDEMOTE_KSWAPD);
        BUILD_BUG_ON(PGSTEAL_KHUGEPAGED - PGSTEAL_KSWAPD !=
                        PGDEMOTE_KHUGEPAGED - PGDEMOTE_KSWAPD);
-#endif
        BUILD_BUG_ON(PGSTEAL_DIRECT - PGSTEAL_KSWAPD !=
                        PGSCAN_DIRECT - PGSCAN_KSWAPD);
        BUILD_BUG_ON(PGSTEAL_KHUGEPAGED - PGSTEAL_KSWAPD !=
@@ -978,10 +976,9 @@ static unsigned int demote_folio_list(struct list_head *demote_folios,
        migrate_pages(demote_folios, alloc_demote_folio, NULL,
                      (unsigned long)&mtc, MIGRATE_ASYNC, MR_DEMOTION,
                      &nr_succeeded);
-#ifdef CONFIG_NUMA_BALANCING
+
        mod_node_page_state(pgdat, PGDEMOTE_KSWAPD + reclaimer_offset(),
                            nr_succeeded);
-#endif
 
        return nr_succeeded;
 }
index cfd8d8256f8eaee68e69015423d3269a1543dbff..1437ca2f28c5fa1fd9a1b096dbe625d94a7dffc4 100644 (file)
@@ -1248,10 +1248,10 @@ const char * const vmstat_text[] = {
 #ifdef CONFIG_NUMA_BALANCING
        "pgpromote_success",
        "pgpromote_candidate",
+#endif
        "pgdemote_kswapd",
        "pgdemote_direct",
        "pgdemote_khugepaged",
-#endif
 
        /* enum writeback_stat_item counters */
        "nr_dirty_threshold",