Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 157315
b: refs/heads/master
c: 967cc53
h: refs/heads/master
i:
  157313: 0636083
  157311: a73562f
v: v3
  • Loading branch information
Oleg Nesterov authored and James Morris committed Jul 16, 2009
1 parent 7a84d4c commit d4f50e1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5bb459bb45d1ad3c177485dcf0af01580aa31125
refs/heads/master: 967cc5371113f9806b39a2ebb2174af2883d96fe
10 changes: 6 additions & 4 deletions trunk/lib/is_single_threaded.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,13 @@ bool current_is_single_threaded(void)
struct task_struct *p, *t;
bool ret;

might_sleep();

if (atomic_read(&task->signal->live) != 1)
return false;

if (atomic_read(&mm->mm_users) == 1)
return true;

ret = false;
down_write(&mm->mmap_sem);
rcu_read_lock();
for_each_process(p) {
if (unlikely(p->flags & PF_KTHREAD))
Expand All @@ -45,12 +42,17 @@ bool current_is_single_threaded(void)
goto found;
if (likely(t->mm))
break;
/*
* t->mm == NULL. Make sure next_thread/next_task
* will see other CLONE_VM tasks which might be
* forked before exiting.
*/
smp_rmb();
} while_each_thread(p, t);
}
ret = true;
found:
rcu_read_unlock();
up_write(&mm->mmap_sem);

return ret;
}

0 comments on commit d4f50e1

Please sign in to comment.