summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMichel Lespinasse <walken@google.com>2012-12-12 22:52:25 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-13 02:38:35 +0100
commit4128997b5f0e7ad583a5f3990051b8188b39055c (patch)
tree239c6c1b6c79fab5b42fd5927614229a57df5de5 /tools
parentmemcg: do not check for mm in __mem_cgroup_count_vm_event (diff)
downloadlinux-4128997b5f0e7ad583a5f3990051b8188b39055c.tar.xz
linux-4128997b5f0e7ad583a5f3990051b8188b39055c.zip
mm: protect against concurrent vma expansion
expand_stack() runs with a shared mmap_sem lock. Because of this, there could be multiple concurrent stack expansions in the same mm, which may cause problems in the vma gap update code. I propose to solve this by taking the mm->page_table_lock around such vma expansions, in order to avoid the concurrency issue. We only have to worry about concurrent expand_stack() calls here, since we hold a shared mmap_sem lock and all vma modificaitons other than expand_stack() are done under an exclusive mmap_sem lock. I previously tried to achieve the same effect by making sure all growable vmas in a given mm would share the same anon_vma, which we already lock here. However this turned out to be difficult - all of the schemes I tried for refcounting the growable anon_vma and clearing turned out ugly. So, I'm now proposing only the minimal fix. The overhead of taking the page table lock during stack expansion is expected to be small: glibc doesn't use expandable stacks for the threads it creates, so having multiple growable stacks is actually uncommon and we don't expect the page table lock to get bounced between threads. Signed-off-by: Michel Lespinasse <walken@google.com> Cc: Hugh Dickins <hughd@google.com> Cc: Rik van Riel <riel@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions