From: Zhan Xusheng <zhanxusheng1024@gmail.com>
To: mhocko@suse.com
Cc: akpm@linux-foundation.org, hannes@cmpxchg.org,
roman.gushchin@linux.dev, shakeel.butt@linux.dev,
muchun.song@linux.dev, penguin-kernel@i-love.sakura.ne.jp,
tj@kernel.org, mkoutny@suse.com, cgroups@vger.kernel.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, zhanxusheng@xiaomi.com
Subject: Re: [PATCH] mm: memcontrol: don't miss processes whose leader has exited in OOM scans
Date: Mon, 2 Nov 2026 19:40:29 +0800 [thread overview]
Message-ID: <20261102114029.1259655-1-zhanxusheng1024@gmail.com> (raw)
In-Reply-To: <auhiGqKJeukk7t3P@tiehlicka>
Hi Michal,
This is v1. v2 [1] reworked the check, but your questions apply to
both.
On Mon, Nov 02, 2026 at 11:12:42AM +0100, Michal Hocko wrote:
> Is this a desirable/intended behavior? Shouldn't we move the dead leader
> along with the rest?
Userspace sees it too. After writing the PID of such a process to
dst/cgroup.procs:
src: cgroup.procs = 85 cgroup.threads = (empty)
dst: cgroup.procs = (empty) cgroup.threads = 86 87
Moving the leader would fix that, and memcg would then need no change,
as the PROCS walk already returns a dying leader with live threads.
The catch is that the leader has already gone through
cgroup_task_dead() and is still accounted by controllers: pids, for
one, uncharges it through task_css() when it is reaped, so the move
would also have to transfer its pids charge. Tejun, would that be
acceptable in the core?
> Should CSS_TASK_ITER_PROCS iteration see all processes
> regardless leader being alive after or prior the migration?
With the leader moved, it would. Otherwise PROCS would have to pick a
stand-in thread, which is what this patch does inside memcg.
> Shouldn't this be CSS_TASK_ITER_THREADED instead of 0?
No. Walking a memcg css goes over e_csets[memory], which already
includes the csets of threaded descendants, as memory is not a
threaded controller. THREADED also walks each cset's threaded_csets,
so those would be visited twice. It is meant for walks over
cgrp->self, like cgroup.procs. 0 is also what this function used
before f168a9a54ec3.
[1] https://lore.kernel.org/all/20261027144016.2582880-1-zhanxusheng1024@gmail.com/
Thanks,
Zhan Xusheng
next prev parent reply other threads:[~2026-11-02 11:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 12:02 [PATCH] mm: memcontrol: don't miss processes whose leader has exited in OOM scans Zhan Xusheng
2026-10-27 8:39 ` [PATCH] selftests: cgroup: test memcg OOM on a process whose leader has exited Zhan Xusheng
2026-10-27 12:03 ` [PATCH] mm: memcontrol: don't miss processes whose leader has exited in OOM scans sashiko-bot
2026-10-27 13:26 ` Tao Cui
2026-11-02 10:12 ` Michal Hocko
2026-11-02 11:40 ` Zhan Xusheng [this message]
2026-11-13 8:19 ` Michal Hocko
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=20261102114029.1259655-1-zhanxusheng1024@gmail.com \
--to=zhanxusheng1024@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--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=penguin-kernel@i-love.sakura.ne.jp \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=stable@vger.kernel.org \
--cc=tj@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.