public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
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: Sat, 27 Dec 2025 12:51:57 -1000	[thread overview]
Message-ID: <aVBjDYPQcKEesoKu@slm.duckdns.org> (raw)
In-Reply-To: <20251223102124.738818-4-ptikhomirov@virtuozzo.com>

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?

Thanks.

-- 
tejun

  parent reply	other threads:[~2025-12-27 22:51 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 [this message]
2025-12-29  5:32     ` Pavel Tikhomirov
2025-12-29 17:39       ` Tejun Heo
2025-12-29  7:05     ` Pavel Tikhomirov
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=aVBjDYPQcKEesoKu@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkoutny@suse.com \
    --cc=ptikhomirov@virtuozzo.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