Skip to content
Commit a479b078 authored by Li Zhijian's avatar Li Zhijian Committed by Andrew Morton
Browse files

mm/vmscan: accumulate nr_demoted for accurate demotion statistics

In shrink_folio_list(), demote_folio_list() can be called 2 times. 
Currently stat->nr_demoted will only store the last nr_demoted( the later
nr_demoted is always zero, the former nr_demoted will get lost), as a
result number of demoted pages is not accurate.

Accumulate the nr_demoted count across multiple calls to
demote_folio_list(), ensuring accurate reporting of demotion statistics.

[lizhijian@fujitsu.com: introduce local nr_demoted to fix nr_reclaimed double counting]
  Link: https://lkml.kernel.org/r/20250111015253.425693-1-lizhijian@fujitsu.com
Link: https://lkml.kernel.org/r/20250110122133.423481-1-lizhijian@fujitsu.com


Fixes: f77f0c75 ("mm,memcg: provide per-cgroup counters for NUMA balancing operations")
Signed-off-by: default avatarLi Zhijian <lizhijian@fujitsu.com>
Acked-by: default avatarKaiyang Zhao <kaiyang2@cs.cmu.edu>
Tested-by: default avatarDonet Tom <donettom@linux.ibm.com>
Reviewed-by: default avatarDonet Tom <donettom@linux.ibm.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent f921da2c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment