Re: + procfs-provide-stack-information-for-threads-v08.patch addedto -mm tree

From: Stefani Seibold
Date: Tue Jun 16 2009 - 02:17:41 EST


Am Dienstag, den 16.06.2009, 02:33 +0400 schrieb Alexey Dobriyan:
> On Mon, Jun 15, 2009 at 03:02:05PM -0700, akpm@xxxxxxxxxxxxxxxxxxxx wrote:
> > procfs-provide-stack-information-for-threads-v08.patch
> > --- a/fs/proc/array.c~procfs-provide-stack-information-for-threads-v08
>
> > +++ a/fs/proc/array.c
> > @@ -321,6 +321,54 @@ static inline void task_context_switch_c
> > p->nivcsw);
> > }
> >
> > +static inline unsigned long get_stack_usage_in_bytes(struct vm_area_struct *vma,
> > + struct task_struct *p)
> > +{
> > + unsigned long i;
> > + struct page *page;
> > + unsigned long stkpage;
> > +
> > + stkpage = KSTK_ESP(p) & PAGE_MASK;
> > +
> > +#ifdef CONFIG_STACK_GROWSUP
> > + for (i = vma->vm_end; i-PAGE_SIZE > stkpage; i -= PAGE_SIZE) {
> > +
> > + page = follow_page(vma, i-PAGE_SIZE, 0);
>
> How can this work?
>
> If stack page got swapped out, you'll get smaller than actual result.
>

If you tell me how to do it in the right way, i can fix it!


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/