[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87fvbdv2g3.fsf@rasmusvillemoes.dk>
Date: Wed, 14 Jan 2015 15:53:16 +0100
From: Rasmus Villemoes <linux@...musvillemoes.dk>
To: Siddhesh Poyarekar <siddhesh.poyarekar@...il.com>
Cc: Calvin Owens <calvinowens@...com>,
Andrew Morton <akpm@...ux-foundation.org>,
Alexey Dobriyan <adobriyan@...il.com>,
Oleg Nesterov <oleg@...hat.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Al Viro <viro@...iv.linux.org.uk>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Peter Feiner <pfeiner@...gle.com>,
Grant Likely <grant.likely@...retlab.ca>,
linux-kernel <linux-kernel@...r.kernel.org>, kernel-team@...com
Subject: Re: [RFC][PATCH] procfs: Add /proc/<pid>/mapped_files
On Wed, Jan 14 2015, Siddhesh Poyarekar <siddhesh.poyarekar@...il.com> wrote:
> On 14 January 2015 at 19:43, Rasmus Villemoes <linux@...musvillemoes.dk> wrote:
>> Just thinking out loud: Could one simply mark a VMA as being used for
>> stack during the clone call (is there room in vm_flags, or does
>> VM_GROWSDOWN already tell the whole story?), and then write the TID into
>> a new field in the VMA - I think one could make a union with vm_pgoff so
>> as not to enlarge the structure.
>
> vm_flags does not have space IIRC (that was my first approach at
> implementing this) and VM_GROWSDOWN is not sufficient.
Looking at include/linux/mm.h:
#define VM_GROWSDOWN 0x00000100 /* general info on the segment */
#define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */
#define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */
It would seem that 0x00000200 is available (unless defined and used
somewhere else).
> If we can make a union with vm_pgoff like you say, we probably don't
> need a flag value; a non-zero value could indicate that it is a thread
> stack.
Well, only when combined with checking vm_file for being NULL. One would
also need to ensure that vm_pgoff is 0 for any non-stack,
non-file-backed VMA. At which point it is somewhat ugly.
> One problem with caching the value on clone like this though is that
> the stack could change due to a setcontext, but AFAICT we don't care
> about that for the process stack either.
If it is important, I guess one could update the info when a task calls
setcontext.
Rasmus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists