From: Siddhesh Poyarekar <siddhesh.poyarekar@gmail.com>
To: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Alexander Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org, Jamie Lokier <jamie@shareable.org>,
vapier@gentoo.org, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] Mark thread stack correctly in proc/<pid>/maps
Date: Sat, 25 Feb 2012 00:28:38 +0530 [thread overview]
Message-ID: <CAAHN_R3-Rh1_vQAH5DHxw56Ukhif0Oq91qghrYoQ04nx=adUyQ@mail.gmail.com> (raw)
In-Reply-To: <4F47B781.2050300@gmail.com>
On Fri, Feb 24, 2012 at 9:44 PM, KOSAKI Motohiro
<kosaki.motohiro@gmail.com> wrote:
> Oh, maybe generically you are right. but you missed one thing. Before
> your patch, stack or not stack are address space property. thus, using
> /proc/pid/maps makes sense. but after your patch, it's no longer memory
> property. applications can use heap or mapped file as a stack. then, at
> least, current your code is wrong. the code assume each memory property
> are exclusive.
Right, but I cannot think of any other alternative that does not
involve touching some sensitive code.
The setcontext family of functions where any heap, stack or even data
area portion could be used as stack, break the very concept of an
entire vma being used as a stack. In such a scenario the kernel can
only show what it knows, which is that a specific vma is being used as
a stack. I agree that it is not correct to show the entire vma as
stack, but there doesn't seem to be a better way right now in that
implementation. FWIW, if the stack space is allocated in heap, it will
show up as heap and not stack since the former gets preference.
> Moreover, if pthread stack is unimportant, I wonder why we need this patch
> at all. Which application does need it? and When?
Right, my original intent was to mark stack vmas allocated by
pthreads, which included those vmas that are in the pthreads cache.
However, this means that the kernel does not have any real control
over what it marks as stack. Also, the concept is very specific to the
glibc pthreads implementation and we're essentially just making the
kernel spit out some data blindly for glibc.
The other solution I can think of is to have stack_start as a task
level property so that each task knows their stack vma start (obtained
from its sys_clone call and not from mmap). This however means
increasing the size of task_struct by sizeof(unsigned long). Is that
overhead acceptable?
--
Siddhesh Poyarekar
http://siddhesh.in
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2012-02-24 18:58 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-14 12:35 Siddhesh Poyarekar
2012-01-16 11:28 ` Jamie Lokier
2012-01-16 13:08 ` Siddhesh Poyarekar
2012-01-16 16:31 ` Jamie Lokier
2012-01-16 17:01 ` Siddhesh Poyarekar
2012-01-17 4:54 ` Siddhesh Poyarekar
2012-02-02 6:24 ` [RESEND][PATCH] " Siddhesh Poyarekar
2012-02-02 21:40 ` KOSAKI Motohiro
2012-02-03 7:09 ` Siddhesh Poyarekar
2012-02-03 8:01 ` KOSAKI Motohiro
2012-02-03 9:49 ` Siddhesh Poyarekar
2012-02-03 10:29 ` Mike Frysinger
2012-02-03 18:34 ` Siddhesh Poyarekar
2012-02-08 4:00 ` Siddhesh Poyarekar
2012-02-08 17:57 ` KOSAKI Motohiro
2012-02-11 10:19 ` Siddhesh Poyarekar
2012-02-11 15:03 ` [PATCH] " Siddhesh Poyarekar
2012-02-21 4:24 ` [RESEND][PATCH] " Siddhesh Poyarekar
2012-02-22 23:00 ` Andrew Morton
2012-02-23 4:03 ` [PATCH] " Siddhesh Poyarekar
2012-02-23 20:22 ` Andrew Morton
2012-02-24 13:05 ` Siddhesh Poyarekar
2012-02-23 23:47 ` Mike Frysinger
2012-02-24 5:47 ` Siddhesh Poyarekar
2012-02-24 16:12 ` Mike Frysinger
2012-02-24 18:23 ` Siddhesh Poyarekar
2012-02-23 23:17 ` KOSAKI Motohiro
2012-02-24 0:49 ` KOSAKI Motohiro
2012-02-24 5:29 ` Siddhesh Poyarekar
2012-02-24 16:14 ` KOSAKI Motohiro
2012-02-24 18:58 ` Siddhesh Poyarekar [this message]
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='CAAHN_R3-Rh1_vQAH5DHxw56Ukhif0Oq91qghrYoQ04nx=adUyQ@mail.gmail.com' \
--to=siddhesh.poyarekar@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=jamie@shareable.org \
--cc=kosaki.motohiro@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=vapier@gentoo.org \
--cc=viro@zeniv.linux.org.uk \
/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