From: "Denis V. Lunev" <den@openvz.org>
To: khorenko@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.1 v2 3/3] sched: drop task_lock from sched_show_task()
Date: Mon, 16 Nov 2026 14:44:45 +0100 [thread overview]
Message-ID: <20261116134445.438480-4-den@openvz.org> (raw)
In-Reply-To: <20261116134445.438480-1-den@openvz.org>
From: Denis V. Lunev <den@openvz.org>
Commit 35518dbbfd76 ("ve: Switch from task_ve_name() to ve_name()")
made sched_show_task() look the ve up with get_task_ve(), which takes
task_lock of the task being shown. sched_show_task() is a diagnostic
called with interrupts off under raw locks or from an interrupt, while
task_lock is taken with interrupts on, by a /proc/PID/fd read for one:
- the RCU stall reports show the tasks blocking the grace period
under rnp->lock, from the scheduler tick;
- dump_cpu_task() shows the current task of a stuck CPU from the
RCU stall and CSD lock reports; when that task is stuck holding
its own task_lock, the report spins forever instead of printing;
- the workqueue watchdog shows a hogging worker under pool->lock;
- sysrq-t runs show_state() from the keyboard or serial interrupt.
An interrupt or softirq on the CPU holding task_lock that needs
rnp->lock or pool->lock closes a lock cycle, and the node locks up
hard in the middle of reporting a stall.
Print the name under the RCU read lock the function already takes for
the parent pid, with task_ve() and no reference. The ve is freed from
css_free after a grace period, and so is its name since "ve: free
ve_name together with the ve, not at cgroup offline".
Fixes: 35518dbbfd76 ("ve: Switch from task_ve_name() to ve_name()")
https://virtuozzo.atlassian.net/browse/VSTOR-155341
Feature: ve: ve generic structures
Suggested-by: Vasileios Almpanis <vasileios.almpanis@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
kernel/sched/core.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 77587e9982b7..84d2a5c29c69 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7777,7 +7777,6 @@ EXPORT_SYMBOL(io_schedule);
void sched_show_task(struct task_struct *p)
{
- struct ve_struct *ve __free(put_ve) = get_task_ve(p);
unsigned long free;
int ppid;
@@ -7793,10 +7792,10 @@ void sched_show_task(struct task_struct *p)
rcu_read_lock();
if (pid_alive(p))
ppid = task_pid_nr(rcu_dereference(p->real_parent));
- rcu_read_unlock();
pr_cont(" stack:%-5lu pid:%-5d tgid:%-5d ppid:%-6d veid:%-4s task_flags:0x%04x flags:0x%08lx\n",
free, task_pid_nr(p), task_tgid_nr(p),
- ppid, ve_name(ve), p->flags, read_task_thread_flags(p));
+ ppid, ve_name(task_ve(p)), p->flags, read_task_thread_flags(p));
+ rcu_read_unlock();
print_worker_info(KERN_INFO, p);
print_stop_info(KERN_INFO, p);
--
2.55.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-11-16 13:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 13:44 [Devel] [PATCH hci-8.1 v2 0/3] sched: fix hard lockups on task_lock taken under scheduler and diagnostic locks Denis V. Lunev
2026-11-16 13:44 ` [Devel] [PATCH hci-8.1 v2 1/3] sched/stats: fix a hard lockup on task_lock in update_sched_lat() Denis V. Lunev
2026-11-16 13:50 ` no-reply
2026-11-16 16:31 ` Konstantin Khorenko
2026-11-16 13:44 ` [Devel] [PATCH hci-8.1 v2 2/3] ve: free ve_name together with the ve, not at cgroup offline Denis V. Lunev
2026-11-16 13:49 ` no-reply
2026-11-16 16:31 ` Konstantin Khorenko
2026-11-16 13:44 ` Denis V. Lunev [this message]
2026-11-16 13:52 ` [Devel] [PATCH hci-8.1 v2 3/3] sched: drop task_lock from sched_show_task() no-reply
2026-11-16 16:31 ` Konstantin Khorenko
2026-11-16 16:03 ` [Devel] [PATCH hci-8.1 v2 0/3] sched: fix hard lockups on task_lock taken under scheduler and diagnostic locks Vasileios Almpanis
2026-11-16 16:31 ` Konstantin Khorenko
2026-11-16 16:31 ` Konstantin Khorenko
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=20261116134445.438480-4-den@openvz.org \
--to=den@openvz.org \
--cc=devel@openvz.org \
--cc=khorenko@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