2021-08-12 11:07:53

by Shirish S

[permalink] [raw]
Subject: [PATCH] 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

Signed-off-by: Shirish S <[email protected]>
Suggested-by: Steven Rostedt <[email protected]>
---
kernel/sched/core.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 20ffcc044134..1c7ea3ef5a9f 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -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 pid father\n");
+
rcu_read_lock();
for_each_process_thread(g, p) {
/*
--
2.17.1


2021-08-12 15:19:20

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH] sched/debug: print column titles of show_state_filter()

On Thu, 12 Aug 2021 16:35:34 +0530
Shirish S <[email protected]> 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 ~ #
>
> 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 ~ #
>

It would had been more informative, if there were content to those lists.

Just a few lines would be good enough. But the above, just looks like
you are adding a useless header. :-/

In fact, I would argue that the title should not be displayed if the
content is empty.

Also, s/father/parent/ or s/father/ppid/

-- Steve



> v2: Dropped #ifdef logic
> v3: Sample output in commit message
>
> Signed-off-by: Shirish S <[email protected]>
> Suggested-by: Steven Rostedt <[email protected]>
> ---
> kernel/sched/core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 20ffcc044134..1c7ea3ef5a9f 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -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 pid father\n");
> +
> rcu_read_lock();
> for_each_process_thread(g, p) {
> /*

2021-08-12 17:25:14

by Phil Auld

[permalink] [raw]
Subject: Re: [PATCH] sched/debug: print column titles of show_state_filter()

Hi,

On Thu, Aug 12, 2021 at 04:35: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 ~ #
>
> 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
>
> Signed-off-by: Shirish S <[email protected]>
> Suggested-by: Steven Rostedt <[email protected]>
> ---
> kernel/sched/core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 20ffcc044134..1c7ea3ef5a9f 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -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 pid father\n");


"parent" or "ppid" please.


Cheers,
Phil

> +
> rcu_read_lock();
> for_each_process_thread(g, p) {
> /*
> --
> 2.17.1
>

--