* Patch for show_task
@ 2003-04-04 6:38 Pete Zaitcev
2003-04-04 6:43 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Pete Zaitcev @ 2003-04-04 6:38 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel
Andrew, bkbits says you changed the line above to be p->thread_info.
Unfortunately, there's another.
--- linux-2.5.66/kernel/sched.c 2003-03-24 14:01:16.000000000 -0800
+++ linux-2.5.66-sparc/kernel/sched.c 2003-04-03 22:33:29.000000000 -0800
@@ -2197,7 +2197,7 @@
unsigned long * n = (unsigned long *) (p->thread_info+1);
while (!*n)
n++;
- free = (unsigned long) n - (unsigned long)(p+1);
+ free = (unsigned long) n - (unsigned long) (p->thread_info+1);
}
printk("%5lu %5d %6d ", free, p->pid, p->parent->pid);
if ((relative = eldest_child(p)))
-- Pete
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Patch for show_task
2003-04-04 6:38 Patch for show_task Pete Zaitcev
@ 2003-04-04 6:43 ` Andrew Morton
2003-04-04 6:48 ` Pete Zaitcev
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2003-04-04 6:43 UTC (permalink / raw)
To: Pete Zaitcev; +Cc: linux-kernel
Pete Zaitcev <zaitcev@redhat.com> wrote:
>
> Andrew, bkbits says you changed the line above to be p->thread_info.
> Unfortunately, there's another.
>
> --- linux-2.5.66/kernel/sched.c 2003-03-24 14:01:16.000000000 -0800
> +++ linux-2.5.66-sparc/kernel/sched.c 2003-04-03 22:33:29.000000000 -0800
> @@ -2197,7 +2197,7 @@
> unsigned long * n = (unsigned long *) (p->thread_info+1);
> while (!*n)
> n++;
> - free = (unsigned long) n - (unsigned long)(p+1);
> + free = (unsigned long) n - (unsigned long) (p->thread_info+1);
> }
> printk("%5lu %5d %6d ", free, p->pid, p->parent->pid);
> if ((relative = eldest_child(p)))
>
Yup. But the whole thing's dead anyway - we do not clear the kernel stack
when it is allocated hence the attempt to work out how much was used cannot
work.
That's what
ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.5/2.5.66/2.5.66-mm3/broken-out/show_task-free-stack-fix.patch
is about, but it needs finishing off.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Patch for show_task
2003-04-04 6:43 ` Andrew Morton
@ 2003-04-04 6:48 ` Pete Zaitcev
2003-04-04 7:40 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Pete Zaitcev @ 2003-04-04 6:48 UTC (permalink / raw)
To: Andrew Morton; +Cc: Pete Zaitcev, linux-kernel
> Date: Thu, 3 Apr 2003 22:43:46 -0800
> From: Andrew Morton <akpm@digeo.com>
> ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.5/2.5.66/2.5.66-mm3/broken-out/show_task-free-stack-fix.patch
I see. What do you say to adding thread_saved_sp() in addition
to thread_saved_pc()? E.g. on sparc that would return
p->thread_info->ti_ksp, then you can calculate free stack.
-- Pete
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Patch for show_task
2003-04-04 6:48 ` Pete Zaitcev
@ 2003-04-04 7:40 ` Andrew Morton
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2003-04-04 7:40 UTC (permalink / raw)
To: Pete Zaitcev; +Cc: linux-kernel
Pete Zaitcev <zaitcev@redhat.com> wrote:
>
> I see. What do you say to adding thread_saved_sp() in addition
> to thread_saved_pc()? E.g. on sparc that would return
> p->thread_info->ti_ksp, then you can calculate free stack.
>
I don't think the current sp value is very interesting really.
What that code is trying to do is to tell you the minimum amount of stack
which was *ever* available to that process. Now that is interesting. But it
requires that the kernel stack be zeroed out when it is created, and there's
no code in there to do that.
It is probably a useful thing to retain though. A new CONFIG_DEBUG_STACK
would suit.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-04-04 7:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-04 6:38 Patch for show_task Pete Zaitcev
2003-04-04 6:43 ` Andrew Morton
2003-04-04 6:48 ` Pete Zaitcev
2003-04-04 7:40 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox