[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <80d36215-de7e-448c-85ea-9e848496c210@virtuozzo.com>
Date: Mon, 29 Dec 2025 13:32:11 +0800
From: Pavel Tikhomirov <ptikhomirov@...tuozzo.com>
To: Tejun Heo <tj@...nel.org>
Cc: Johannes Weiner <hannes@...xchg.org>, Michal Koutný
<mkoutny@...e.com>, cgroups@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] cgroup-v2/freezer: Print information about
unfreezable process
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, I think that will do, Thanks.
Though 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.
Powered by blists - more mailing lists