Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Zhan Xusheng <zhanxusheng1024@gmail.com>
Cc: hannes@cmpxchg.org, mkoutny@suse.com, mhocko@suse.com,
	roman.gushchin@linux.dev, shakeel.butt@linux.dev,
	muchun.song@linux.dev, akpm@linux-foundation.org,
	kolyshkin@gmail.com, chris@chrisdown.name,
	cgroups@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, zhanxusheng@xiaomi.com
Subject: Re: [PATCH 0/2] cgroup: list processes whose leader has exited where their threads are
Date: Tue, 24 Nov 2026 08:47:26 -1000	[thread overview]
Message-ID: <837253372dc1b40de4e20924c1e4549d@kernel.org> (raw)
In-Reply-To: <20261124033547.2373352-1-zhanxusheng1024@gmail.com>

Hello, Zhan.

On Tue, Nov 24, 2026 at 11:35:45AM +0800, Zhan Xusheng wrote:
> This implements Tejun's suggestion in [1].  Patch 1 makes PROCS walks
> visit an exited leader left behind by a cgroup.procs migration at the
> first live thread of its process.  Patch 2 makes the memcg OOM group
> lookup do the same.

The main problem I see is that it's difficult to keep the walks intact
this way. The thread that a leader is visited at is picked by testing
PF_EXITING, which isn't synchronized with css_set_lock, so, as the comment
in patch 1 notes, a walk can skip a process or visit it more than once. A
walk shouldn't miss processes.

It also looks fragile in general. AFAICS, only cgroup_migrate() sets
cg_leader_left, so when a cgroup.subtree_control write moves the threads
to a new css_set, a walk of that controller's css, e.g. the memcg OOM
scan, still misses the process. And as a walk can now return a leader
whose css_set isn't the process's, every user has to know to use
task_procs_css().

I'm trying out a different approach.

Thanks.

--
tejun


      parent reply	other threads:[~2026-11-24 18:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  3:35 [PATCH 0/2] cgroup: list processes whose leader has exited where their threads are Zhan Xusheng
2026-11-24  3:35 ` [PATCH 1/2] cgroup: list a process whose leader has exited where its " Zhan Xusheng
2026-11-24  3:35 ` [PATCH 2/2] mm: memcontrol: find the OOM group of a process " Zhan Xusheng
2026-11-24 18:47 ` Tejun Heo [this message]

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=837253372dc1b40de4e20924c1e4549d@kernel.org \
    --to=tj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=chris@chrisdown.name \
    --cc=hannes@cmpxchg.org \
    --cc=kolyshkin@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=mkoutny@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=zhanxusheng1024@gmail.com \
    --cc=zhanxusheng@xiaomi.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