lkml.org 
[lkml]   [2010]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC][PATCH 6/8] mm: handle_speculative_fault()
From
Date
On Thu, 2010-01-07 at 10:44 -0800, Linus Torvalds wrote:
>
> On Thu, 7 Jan 2010, Linus Torvalds wrote:
> >
> > For example: there's no real reason why we take mmap_sem for writing when
> > extending an existing vma. And while 'brk()' is a very oldfashioned way of
> > doing memory management, it's still quite common. So rather than looking
> > at subtle lockless algorithms, why not look at doing the common cases of
> > an extending brk? Make that one take the mmap_sem for _reading_, and then
> > do the extending of the brk area with a simple cmpxchg or something?
>
> I didn't use cmpxchg, because we actually want to update both
> 'current->brk' _and_ the vma->vm_end atomically, so here's a totally
> untested patch that uses the page_table_lock spinlock for it instead (it
> could be a new spinlock, not worth it).
>
> It's also totally untested and might be horribly broken. But you get the
> idea.
>
> We could probably do things like this in regular mmap() too for the
> "extend a mmap" case. brk() is just especially simple.

I haven't yet looked at the patch, but isn't expand_stack() kinda like
what you want? That serializes using anon_vma_lock().



\
 
 \ /
  Last update: 2010-01-07 22:47    [W:0.212 / U:0.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site