From: Kinsey Ho <kinseyho@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Hugh Dickins <hughd@google.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
cgroups@vger.kernel.org, Yosry Ahmed <yosryahmed@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Shakeel Butt <shakeel.butt@linux.dev>,
Muchun Song <muchun.song@linux.dev>, Tejun Heo <tj@kernel.org>,
Zefan Li <lizefan.x@bytedance.com>,
mkoutny@suse.com, baolin.wang@linux.alibaba.com,
tjmercier@google.com
Subject: Re: [PATCH mm-unstable v3 4/5] mm: restart if multiple traversals raced
Date: Fri, 30 Aug 2024 10:45:00 -0700 [thread overview]
Message-ID: <CAF6N3nVWPJT+qrcz2jGw+sNoKge1qgDGSYg5f0Ur8a6O8ziUQg@mail.gmail.com> (raw)
In-Reply-To: <56d42242-37fe-b94f-d3cb-00673f1e5efb@google.com>
On Fri, Aug 30, 2024 at 3:04 AM Hugh Dickins <hughd@google.com> wrote:
>
> mm-unstable commit 954dd0848c61 needs the fix below to be merged in;
> but the commit after it (the 5/5) then renames "memcg" to "next",
> so that one has to be adjusted too.
>
> [PATCH] mm: restart if multiple traversals raced: fix
>
> 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()).
>
> Signed-off-by: Hugh Dickins <hughd@google.com>
> ---
> mm/memcontrol.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 6f66ac0ad4f0..dd82dd1e1f0a 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -1049,6 +1049,7 @@ struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *root,
> if (cmpxchg(&iter->position, pos, memcg) != pos) {
> if (css && css != &root->css)
> css_put(css);
> + memcg = NULL;
> goto restart;
> }
>
> --
> 2.35.3
Hi Andrew,
Would you prefer that I resend the series with Hugh's fix inserted?
Acked-by: Kinsey Ho <kinseyho@google.com>
next prev parent reply other threads:[~2024-08-30 17:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-27 23:07 [PATCH mm-unstable v3 0/5] Improve mem_cgroup_iter() Kinsey Ho
2024-08-27 23:07 ` [PATCH mm-unstable v3 1/5] cgroup: clarify css sibling linkage is protected by cgroup_mutex or RCU Kinsey Ho
2024-08-27 23:07 ` [PATCH mm-unstable v3 2/5] mm: don't hold css->refcnt during traversal Kinsey Ho
2024-08-28 17:58 ` T.J. Mercier
2024-08-27 23:07 ` [PATCH mm-unstable v3 3/5] mm: increment gen # before restarting traversal Kinsey Ho
2024-08-28 17:49 ` T.J. Mercier
2024-08-27 23:07 ` [PATCH mm-unstable v3 4/5] mm: restart if multiple traversals raced Kinsey Ho
2024-08-28 17:49 ` T.J. Mercier
2024-08-30 10:04 ` Hugh Dickins
2024-08-30 17:45 ` Kinsey Ho [this message]
2024-08-30 19:04 ` Yu Zhao
2024-08-27 23:07 ` [PATCH mm-unstable v3 5/5] mm: clean up mem_cgroup_iter() Kinsey Ho
2024-08-28 17:49 ` T.J. Mercier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAF6N3nVWPJT+qrcz2jGw+sNoKge1qgDGSYg5f0Ur8a6O8ziUQg@mail.gmail.com \
--to=kinseyho@google.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lizefan.x@bytedance.com \
--cc=mhocko@kernel.org \
--cc=mkoutny@suse.com \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=tj@kernel.org \
--cc=tjmercier@google.com \
--cc=yosryahmed@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox