mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Chris Caputo <ccaputo@alt.net>
Cc: Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org, trivial@kernel.org
Subject: Re: [PATCH 2.6.19-rc6] sched: cleanup output of show_state/show_task
Date: Mon, 27 Nov 2006 14:38:13 -0800	[thread overview]
Message-ID: <20061127143813.a9f4f696.akpm@osdl.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0611250416240.10489@nacho.alt.net>

On Sat, 25 Nov 2006 04:48:15 +0000 (GMT)
Chris Caputo <ccaputo@alt.net> wrote:

> 
> This patch cleans up the output of show_state/task() (aka magic-sysrq-t) 
> so that free stack space is printed as appropriate based on 
> CONFIG_DEBUG_STACK_USAGE.
> 
> Also, without this patch the header is not aligned with the data and is 
> thus confusing.  Free stack is labeled as pid, pid is labeled as father, 
> and so on.
> 
> Signed-off-by: Chris Caputo <ccaputo@alt.net>
> ---
> 
> diff -uprN a/kernel/sched.c b/kernel/sched.c
> --- a/kernel/sched.c	2006-11-25 04:11:12.000000000 +0000
> +++ b/kernel/sched.c	2006-11-25 04:13:07.000000000 +0000
> @@ -4757,7 +4757,6 @@ static const char stat_nam[] = "RSDTtZX"
>  static void show_task(struct task_struct *p)
>  {
>  	struct task_struct *relative;
> -	unsigned long free = 0;
>  	unsigned state;
>  
>  	state = p->state ? __ffs(p->state) + 1 : 0;
> @@ -4779,10 +4778,10 @@ static void show_task(struct task_struct
>  		unsigned long *n = end_of_stack(p);
>  		while (!*n)
>  			n++;
> -		free = (unsigned long)n - (unsigned long)end_of_stack(p);
> +		printk("%5lu ", (unsigned long)n - (unsigned long)end_of_stack(p));
>  	}
>  #endif
> -	printk("%5lu %5d %6d ", free, p->pid, p->parent->pid);
> +	printk("%5d %6d ", p->pid, p->parent->pid);

This will cause the output format to be dependent upon the setting of
CONFIG_DEBUG_STACK_USAGE.  So any code which attempts to parse the output
of this function will somehow need to work out whether or not the `free'
field is present.

Which is why we still print out a zero if CONFIG_DEBUG_STACK_USAGE=n.

  reply	other threads:[~2006-11-27 22:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-25  4:48 Chris Caputo
2006-11-27 22:38 ` Andrew Morton [this message]
2006-11-27 23:32   ` Chris Caputo

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=20061127143813.a9f4f696.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=ccaputo@alt.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=trivial@kernel.org \
    /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

all inboxes | Powered by JetHome®