The patch titled Subject: mm: memcg: clear percpu stats_pending during stats flush has been added to the -mm mm-unstable branch. Its filename is mm-memcg-make-stats-flushing-threshold-per-memcg-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-memcg-make-stats-flushing-threshold-per-memcg-fix.patch This patch will later appear in the mm-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: Yosry Ahmed <yosryahmed@xxxxxxxxxx> Subject: mm: memcg: clear percpu stats_pending during stats flush Date: Tue, 17 Oct 2023 23:07:59 +0000 When flushing memcg stats, we clear the per-memcg count of pending stat updates, as they are captured by the flush. Also clear the percpu count for the cpu being flushed. Link: https://lkml.kernel.org/r/CAJD7tkZDarDn_38ntFg5bK2fAmFdSe+Rt6DKOZA7Sgs_kERoVA@xxxxxxxxxxxxxx Signed-off-by: Yosry Ahmed <yosryahmed@xxxxxxxxxx> Suggested-by: Wei Xu <weixugc@xxxxxxxxxx> Cc: Domenico Cerasuolo <cerasuolodomenico@xxxxxxxxx> Cc: Greg Thelen <gthelen@xxxxxxxxxx> Cc: Ivan Babrou <ivan@xxxxxxxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: Michal Koutný <mkoutny@xxxxxxxx> Cc: Muchun Song <muchun.song@xxxxxxxxx> Cc: Roman Gushchin <roman.gushchin@xxxxxxxxx> Cc: Shakeel Butt <shakeelb@xxxxxxxxxx> Cc: Tejun heo <tj@xxxxxxxxxx> Cc: Waiman Long <longman@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memcontrol.c | 1 + 1 file changed, 1 insertion(+) --- a/mm/memcontrol.c~mm-memcg-make-stats-flushing-threshold-per-memcg-fix +++ a/mm/memcontrol.c @@ -5728,6 +5728,7 @@ static void mem_cgroup_css_rstat_flush(s } } } + statc->stats_updates = 0; /* We are in a per-cpu loop here, only do the atomic write once */ if (atomic64_read(&memcg->vmstats->stats_updates)) atomic64_set(&memcg->vmstats->stats_updates, 0); _ Patches currently in -mm which might be from yosryahmed@xxxxxxxxxx are mm-memcg-refactor-page-state-unit-helpers.patch mm-memcg-normalize-the-value-passed-into-memcg_rstat_updated.patch mm-memcg-change-flush_next_time-to-flush_last_time.patch mm-memcg-move-vmstats-structs-definition-above-flushing-code.patch mm-memcg-make-stats-flushing-threshold-per-memcg.patch mm-memcg-make-stats-flushing-threshold-per-memcg-fix.patch mm-workingset-move-the-stats-flush-into-workingset_test_recent.patch mm-memcg-restore-subtree-stats-flushing.patch