diff options
author | Oleg Nesterov <oleg@redhat.com> | 2009-07-09 23:28:49 +0200 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2009-07-17 01:11:31 +0200 |
commit | 967cc5371113f9806b39a2ebb2174af2883d96fe (patch) | |
tree | d99845169cde5e238a02d1e984ff9aa65b66482f /lib/checksum.c | |
parent | kernel: rename is_single_threaded(task) to current_is_single_threaded(void) (diff) | |
download | linux-967cc5371113f9806b39a2ebb2174af2883d96fe.tar.xz linux-967cc5371113f9806b39a2ebb2174af2883d96fe.zip |
kernel: is_current_single_threaded: don't use ->mmap_sem
is_current_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>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'lib/checksum.c')
0 files changed, 0 insertions, 0 deletions