The patch titled Subject: mm-restart-if-multiple-traversals-raced-fix has been added to the -mm mm-unstable branch. Its filename is mm-restart-if-multiple-traversals-raced-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-restart-if-multiple-traversals-raced-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: Hugh Dickins <hughd@xxxxxxxxxx> Subject: mm-restart-if-multiple-traversals-raced-fix Date: Fri, 30 Aug 2024 03:04:01 -0700 (PDT) mem_cgroup_iter() reset memcg to NULL before the goto restart, so that goto out_unlock does not then return an ungotten memcg, causing oopses on stale memcg in many places (often in memcg_rstat_updated()). Link: https://lkml.kernel.org/r/56d42242-37fe-b94f-d3cb-00673f1e5efb@xxxxxxxxxx Signed-off-by: Hugh Dickins <hughd@xxxxxxxxxx> Acked-by: Kinsey Ho <kinseyho@xxxxxxxxxx> 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 <shakeel.butt@xxxxxxxxx> Cc: Tejun Heo <tj@xxxxxxxxxx> Cc: T.J. Mercier <tjmercier@xxxxxxxxxx> Cc: Yosry Ahmed <yosryahmed@xxxxxxxxxx> Cc: Zefan Li <lizefan.x@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memcontrol.c | 1 + 1 file changed, 1 insertion(+) --- a/mm/memcontrol.c~mm-restart-if-multiple-traversals-raced-fix +++ a/mm/memcontrol.c @@ -1049,6 +1049,7 @@ restart: if (cmpxchg(&iter->position, pos, memcg) != pos) { if (css && css != &root->css) css_put(css); + memcg = NULL; goto restart; } _ Patches currently in -mm which might be from hughd@xxxxxxxxxx are mm-attempt-to-batch-free-swap-entries-for-zap_pte_range-fix-2.patch mm-shmem-split-large-entry-if-the-swapin-folio-is-not-large-fix.patch mm-shmem-support-large-folio-swap-out-fix.patch mm-restart-if-multiple-traversals-raced-fix.patch mm-shmem-fix-minor-off-by-one-in-shrinkable-calculation.patch mm-shmem-extend-shmem_unused_huge_shrink-to-all-sizes.patch