From 3f8cb6aae58ca204f8fa8de959e04e33e36924f4 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Mon, 2 Mar 2015 21:10:46 +0000 Subject: [PATCH] Update a comment. Apparently the code was refactored at some point... git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14973 --- coregrind/m_signals.c | 4 ++++ coregrind/m_syswrap/syswrap-main.c | 17 ++--------------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/coregrind/m_signals.c b/coregrind/m_signals.c index deecebe27e..1cd3179d7b 100644 --- a/coregrind/m_signals.c +++ b/coregrind/m_signals.c @@ -2260,6 +2260,10 @@ Bool VG_(extend_stack)(Addr addr, UInt maxsize) = seg ? VG_(am_next_nsegment)( seg, True/*fwds*/ ) : NULL; + /* TODO: the test "seg->kind == SkAnonC" is really inadequate, + because although it tests whether the segment is mapped + _somehow_, it doesn't check that it has the right permissions + (r,w, maybe x) ? */ if (seg && seg->kind == SkAnonC) /* addr is already mapped. Nothing to do. */ return True; diff --git a/coregrind/m_syswrap/syswrap-main.c b/coregrind/m_syswrap/syswrap-main.c index ac1d7bef5e..0d42d16f02 100644 --- a/coregrind/m_syswrap/syswrap-main.c +++ b/coregrind/m_syswrap/syswrap-main.c @@ -1464,28 +1464,15 @@ void VG_(client_syscall) ( ThreadId tid, UInt trc ) possible valid address for stack (sp - redzone), to ensure the pages all the way down to that address, are mapped. Because this is a potentially expensive and frequent operation, we - filter in two ways: + do the following: - First, only the main thread (tid=1) has a growdown stack. So + Only the main thread (tid=1) has a growdown stack. So ignore all others. It is conceivable, although highly unlikely, that the main thread exits, and later another thread is allocated tid=1, but that's harmless, I believe; VG_(extend_stack) will do nothing when applied to a non-root thread. - Secondly, first call VG_(am_find_nsegment) directly, to see if - the page holding (sp - redzone) is mapped correctly. If so, do - nothing. This is almost always the case. VG_(extend_stack) - calls VG_(am_find_nsegment) twice, so this optimisation -- and - that's all it is -- more or less halves the number of calls to - VG_(am_find_nsegment) required. - - TODO: the test "seg->kind == SkAnonC" is really inadequate, - because although it tests whether the segment is mapped - _somehow_, it doesn't check that it has the right permissions - (r,w, maybe x) ? We could test that here, but it will also be - necessary to fix the corresponding test in VG_(extend_stack). - All this guff is of course Linux-specific. Hence the ifdef. */ # if defined(VGO_linux) -- 2.47.3