Re: [PATCH] NOMMU: add [stack] label to per-process maps output

From: David Howells
Date: Wed Dec 16 2009 - 03:55:14 EST


Mike Frysinger <vapier@xxxxxxxxxx> wrote:

> it'd be cool if the global /proc/maps could display something like
> [stack/<pid>], but i can't quite divine how to get a mm_struct out
> of a vm_region without having to walk the entire process list.

Tricky. vm_regions can be shared between multiple mm_structs, although in the
case of the stack, they're probably not. Furthermore, there's no interface to
mmap() to say the region you're allocating belongs to a particular PID (and
with userspace created threads, you have to create the stack _before_ calling
clone()).

That said, you could add a 'creator pid' to the vm_region. This could be set
firstly by mmap() to current->pid, and then overridden by clone() for the
stack VMA. It would be approximate, but probably a good approximation. You
probably don't actually need a back pointer, just an integer PID.

David
--
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/