From: Tejun Heo <tj@kernel.org>
To: Qu Wenruo <wqu@suse.com>
Cc: cgroups@vger.kernel.org
Subject: Re: freezing() returned false when the cgroup is being frozen
Date: Sat, 18 Oct 2025 13:22:15 -1000 [thread overview]
Message-ID: <aPQhJ2EW8wzuyjJr@slm.duckdns.org> (raw)
In-Reply-To: <d41dff2c-71e5-4ea3-b7d5-8412b5b0b3e6@suse.com>
Hello,
On Sat, Oct 18, 2025 at 07:32:16PM +1030, Qu Wenruo wrote:
...
> Not familiar with cgroup, but it looks like the CGROUP_FREEZING bits are
> only set during freezer_css_online(), but not sure if for the long running
> ioctl case it's properly triggered.
>
> Anyway the freezing() checks can be worked around by checking pending
> signals inside btrfs, as cgroup freezing will send a wakeup signal to the
> process.
>
> Just curious if the freezing(current) is supposed to return false for the
> cgroup freezing case.
cgroup1 and cgroup2 have completely separate freezer implementation.
cgroup1's piggy back on the PM freezer which can freeze user and kthreads at
arbitrary freezing points. While that's fine for system-wide PM freezing, it
becomes a problem for cgroup freezing as users now can produce unkillable
frozen processes at will, which can create interesting problems (e.g. IIRC
the unkillable state can become transitive through ptrace).
Instead, cgroup2 freezer is a part of the task job control mechanism (the
same thing that SIGTSTP/SIGSTOP uses) and a frozen task behaves as if it has
sticky SIGSTOP signal pending. You can kill it, ptrace it and so on. As
such, it doesn't interact with the PM freezing mechanism at all. I suppose
you aren't talking about kthreads, right? It's just user threads doing
long-running ioctl's in btrfs code? If so, this should be no different from
getting any other signals. ie. If the code can handle signals and
task_work(), cgroup2 freezer should work fine too.
Thanks.
--
tejun
next prev parent reply other threads:[~2025-10-18 23:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-18 9:02 freezing() returned false when the cgroup is being frozen Qu Wenruo
2025-10-18 23:22 ` Tejun Heo [this message]
2025-10-18 23:32 ` Qu Wenruo
2025-10-19 5:26 ` Tejun Heo
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=aPQhJ2EW8wzuyjJr@slm.duckdns.org \
--to=tj@kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=wqu@suse.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