lkml.org 
[lkml]   [2009]   [Jul]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v2 -mm 2/2] current_is_single_threaded: don't use ->mmap_sem
Date
Oleg Nesterov <oleg@redhat.com> wrote:

> current_is_single_threaded() can safely miss a freshly forked CLONE_VM
> task, but in this case it must not miss its parent. That is why we take
> mm->mmap_sem for writing to make sure a thread/task with the same ->mm
> can't pass exit_mm() and disappear.
>
> However we can avoid ->mmap_sem and rely on rcu/barriers:
>
> - if we do not see the exiting parent on thread/process list
> we see the result of list_del_rcu(), in this case we must
> also see the result of list_add_rcu() which does wmb().
>
> - if we do see the parent but its ->mm == NULL, we need rmb()
> to make sure we can't miss the child.
>
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>

Acked-by: David Howells <dhowells@redhat.com>


\
 
 \ /
  Last update: 2009-07-10 16:11    [W:0.450 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site