Skip to contentSkip to conversation

sched/debug: print column titles of show_state_filter()

PATCH In review Shirish S 2 participants 2 messages Aug 12, 2021 Scheduler

lore
Share & tools
lore

Shirish S

author
#0 lore raw

PATCH 1/1 sched/debug: print column titles of show_state_filter()

This addition in the debug output shall improve readablitly.. Its not intuitive for users that the pid printed in last column is of parent process.

Without this patch:
localhost ~ # dmesg -w &
localhost ~ # echo w > /proc/sysrq-trigger [22148.730225] sysrq: Show Blocked State localhost ~ #

With this patch:
localhost ~ # dmesg -w &
localhost ~ # echo w > /proc/sysrq-trigger
[ 99.979365] sysrq: Show Blocked State
--> [ 99.983471] task PC stack pid father
localhost ~ #

v2: Dropped #ifdef logic
v3: Sample output in commit message

---
 kernel/sched/core.c | 3 +++
 1 file changed, 3 insertions(+)
kernel/sched/core.c +3 -0
index 20ffcc044134..d9c7014870d5 100644
@@ -8174,6 +8174,9 @@ void show_state_filter(unsigned int state_filter)
 {
 	struct task_struct *g, *p;
 
+	pr_info("  task%*s", BITS_PER_LONG == 32 ? 38 : 46,
+		"PC stack   ppid\n");
+
 	rcu_read_lock();
 	for_each_process_thread(g, p) {
 		/*
Signature · 1 line
2.17.1
#1 lore raw

Hi,

Quoted 10 lines · On Thu, Aug 12, 2021 at 07:39:34PM +0530 Shirish S wrote:

This addition in the debug output shall improve readablitly.. Its not intuitive for users that the pid printed in last column is of parent process.

Without this patch:
localhost ~ # dmesg -w &
localhost ~ # echo w > /proc/sysrq-trigger [22148.730225] sysrq: Show Blocked State localhost ~ #

Quoted 6 lines

With this patch:
localhost ~ # dmesg -w &
localhost ~ # echo w > /proc/sysrq-trigger
[ 99.979365] sysrq: Show Blocked State
--> [ 99.983471] task PC stack pid father
localhost ~ #

Thanks. Probably want to update this "father" too.

And as Steve said, maybe a line or 2 of actual data?

Cheers,
Phil

Quoted 27 lines

v2: Dropped #ifdef logic
v3: Sample output in commit message

---
 kernel/sched/core.c | 3 +++
 1 file changed, 3 insertions(+)
kernel/sched/core.c +3 -0
index 20ffcc044134..d9c7014870d5 100644
@@ -8174,6 +8174,9 @@ void show_state_filter(unsigned int state_filter)
 {
 	struct task_struct *g, *p;
 
+	pr_info("  task%*s", BITS_PER_LONG == 32 ? 38 : 46,
+		"PC stack   ppid\n");
+
 	rcu_read_lock();
 	for_each_process_thread(g, p) {
 		/*
Signature · 1 line
2.17.1