From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
To: Tejun Heo <tj@kernel.org>
Cc: "Johannes Weiner" <hannes@cmpxchg.org>,
"Michal Koutný" <mkoutny@suse.com>,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] cgroup-v2/freezer: Print information about unfreezable process
Date: Mon, 29 Dec 2025 15:05:28 +0800 [thread overview]
Message-ID: <41e07697-0d59-421e-a121-e6c91a8bf6eb@virtuozzo.com> (raw)
In-Reply-To: <aVBjDYPQcKEesoKu@slm.duckdns.org>
On 12/28/25 06:51, Tejun Heo wrote:
> Hello,
>
> On Tue, Dec 23, 2025 at 06:20:09PM +0800, Pavel Tikhomirov wrote:
>> +static void warn_freeze_timeout(struct cgroup *cgrp, int timeout)
>> +{
>> + char *buf __free(kfree) = NULL;
>> + struct cgroup_subsys_state *css;
>> +
>> + guard(rcu)();
>> + css_for_each_descendant_post(css, &cgrp->self) {
>> + struct task_struct *task;
>> + struct css_task_iter it;
>> +
>> + css_task_iter_start(css, 0, &it);
>> + while ((task = css_task_iter_next(&it))) {
>> + if (task->flags & PF_KTHREAD)
>> + continue;
>> + if (task->frozen)
>> + continue;
>> +
>> + warn_freeze_timeout_task(cgrp, timeout, task);
>> + css_task_iter_end(&it);
>> + return;
>> + }
>> + css_task_iter_end(&it);
>> + }
>> +
>> + buf = kmalloc(PATH_MAX, GFP_KERNEL);
>> + if (!buf)
>> + return;
>> +
>> + if (cgroup_path(cgrp, buf, PATH_MAX) < 0)
>> + return;
>> +
>> + pr_warn("Freeze of %s took %ld sec, but no unfreezable process detected.\n",
>> + buf, timeout / USEC_PER_SEC);
>> +}
>
> This is only suitable for debugging, and, for that, this can be done from
> userspace by walking the tasks and check /proc/PID/wchan. Should be
> do_freezer_trap for everything frozen. If something is not, read and dump
> its /proc/PID/stack. Wouldn't that work?
Yes, that will do. I just hoped it might be a little bit more robust to detect it in kernel. Thanks.
Note the trace printing in /proc/PID/stack is a bit less informative than show_stack(), e.g. for my test module (https://github.com/Snorch/proc-hang-module) the stack in /proc/PID/stack will be just empty. (I guess it has to do with the fact that you need less privileges to read /proc/PID/stack than dmesg, so you can do a more informative thing in dmesg.
>
> Thanks.
>
--
Best regards, Pavel Tikhomirov
Senior Software Developer, Virtuozzo.
next prev parent reply other threads:[~2025-12-29 7:05 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-23 10:20 [PATCH 0/2] cgroup-v2/freezer: small improvements Pavel Tikhomirov
2025-12-23 10:20 ` [PATCH 1/2] cgroup-v2/freezer: allow freezing with kthreads Pavel Tikhomirov
2025-12-23 10:25 ` Pavel Tikhomirov
2025-12-23 10:20 ` [PATCH 1/2] cgroup-v2/freezer: Allow " Pavel Tikhomirov
2025-12-23 10:20 ` [PATCH 2/2] cgroup-v2/freezer: Print information about unfreezable process Pavel Tikhomirov
2025-12-23 20:58 ` kernel test robot
2025-12-24 4:43 ` Pavel Tikhomirov
2025-12-24 1:30 ` kernel test robot
2025-12-24 3:26 ` kernel test robot
2025-12-24 4:28 ` kernel test robot
2025-12-24 11:03 ` kernel test robot
2025-12-27 22:51 ` Tejun Heo
2025-12-29 5:32 ` Pavel Tikhomirov
2025-12-29 17:39 ` Tejun Heo
2025-12-29 7:05 ` Pavel Tikhomirov [this message]
2025-12-23 17:29 ` [PATCH 0/2] cgroup-v2/freezer: small improvements Michal Koutný
2025-12-24 3:06 ` Pavel Tikhomirov
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=41e07697-0d59-421e-a121-e6c91a8bf6eb@virtuozzo.com \
--to=ptikhomirov@virtuozzo.com \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkoutny@suse.com \
--cc=tj@kernel.org \
/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.