The patch titled Subject: mm/vmscan: accumulate nr_demoted for accurate demotion statistics has been added to the -mm mm-hotfixes-unstable branch. Its filename is mm-vmscan-accumulate-nr_demoted-for-accurate-demotion-statistics.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-vmscan-accumulate-nr_demoted-for-accurate-demotion-statistics.patch This patch will later appear in the mm-hotfixes-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Li Zhijian <lizhijian@xxxxxxxxxxx> Subject: mm/vmscan: accumulate nr_demoted for accurate demotion statistics Date: Fri, 10 Jan 2025 20:21:32 +0800 In shrink_folio_list(), demote_folio_list() can be called multiple times, which can lead to inaccurate demotion statistics if the number of demoted pages is not accumulated correctly. Accumulate the nr_demoted count across multiple calls to demote_folio_list(), ensuring accurate reporting of demotion statistics. Link: https://lkml.kernel.org/r/20250110122133.423481-1-lizhijian@xxxxxxxxxxx Fixes: f77f0c751478 ("mm,memcg: provide per-cgroup counters for NUMA balancing operations") Signed-off-by: Li Zhijian <lizhijian@xxxxxxxxxxx> Acked-by: Kaiyang Zhao <kaiyang2@xxxxxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/vmscan.c~mm-vmscan-accumulate-nr_demoted-for-accurate-demotion-statistics +++ a/mm/vmscan.c @@ -1522,7 +1522,7 @@ keep: /* 'folio_list' is always empty here */ /* Migrate folios selected for demotion */ - stat->nr_demoted = demote_folio_list(&demote_folios, pgdat); + stat->nr_demoted += demote_folio_list(&demote_folios, pgdat); nr_reclaimed += stat->nr_demoted; /* Folios that could not be demoted are still in @demote_folios */ if (!list_empty(&demote_folios)) { _ Patches currently in -mm which might be from lizhijian@xxxxxxxxxxx are mm-vmscan-accumulate-nr_demoted-for-accurate-demotion-statistics.patch selftests-mm-add-a-few-missing-gitignore-files.patch