diff options
author | Oleg Nesterov <oleg@redhat.com> | 2012-03-05 17:59:13 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-05 18:49:42 -0500 |
commit | c415c3b47ea2754659d915cca387a20999044163 (patch) | |
tree | c2cb1134f139702e06ade8aecbeff70be7ea727c /kernel/fork.c | |
parent | 880641bb9da2473e9ecf6c708d993b29928c1b3c (diff) |
vfork: introduce complete_vfork_done()
No functional changes.
Move the clear-and-complete-vfork_done code into the new trivial helper,
complete_vfork_done().
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index e2cd3e2a5ae8..cf3d96379608 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -668,6 +668,14 @@ struct mm_struct *mm_access(struct task_struct *task, unsigned int mode) | |||
668 | return mm; | 668 | return mm; |
669 | } | 669 | } |
670 | 670 | ||
671 | void complete_vfork_done(struct task_struct *tsk) | ||
672 | { | ||
673 | struct completion *vfork_done = tsk->vfork_done; | ||
674 | |||
675 | tsk->vfork_done = NULL; | ||
676 | complete(vfork_done); | ||
677 | } | ||
678 | |||
671 | /* Please note the differences between mmput and mm_release. | 679 | /* Please note the differences between mmput and mm_release. |
672 | * mmput is called whenever we stop holding onto a mm_struct, | 680 | * mmput is called whenever we stop holding onto a mm_struct, |
673 | * error success whatever. | 681 | * error success whatever. |
@@ -683,8 +691,6 @@ struct mm_struct *mm_access(struct task_struct *task, unsigned int mode) | |||
683 | */ | 691 | */ |
684 | void mm_release(struct task_struct *tsk, struct mm_struct *mm) | 692 | void mm_release(struct task_struct *tsk, struct mm_struct *mm) |
685 | { | 693 | { |
686 | struct completion *vfork_done = tsk->vfork_done; | ||
687 | |||
688 | /* Get rid of any futexes when releasing the mm */ | 694 | /* Get rid of any futexes when releasing the mm */ |
689 | #ifdef CONFIG_FUTEX | 695 | #ifdef CONFIG_FUTEX |
690 | if (unlikely(tsk->robust_list)) { | 696 | if (unlikely(tsk->robust_list)) { |
@@ -704,11 +710,8 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm) | |||
704 | /* Get rid of any cached register state */ | 710 | /* Get rid of any cached register state */ |
705 | deactivate_mm(tsk, mm); | 711 | deactivate_mm(tsk, mm); |
706 | 712 | ||
707 | /* notify parent sleeping on vfork() */ | 713 | if (tsk->vfork_done) |
708 | if (vfork_done) { | 714 | complete_vfork_done(tsk); |
709 | tsk->vfork_done = NULL; | ||
710 | complete(vfork_done); | ||
711 | } | ||
712 | 715 | ||
713 | /* | 716 | /* |
714 | * If we're exiting normally, clear a user-space tid field if | 717 | * If we're exiting normally, clear a user-space tid field if |