diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2019-11-06 22:55:36 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-01-30 13:32:11 +0100 |
commit | 3fe0ed7bd7329e28aca7cdaf7353c6d4778b3d41 (patch) | |
tree | 3ec3e10f4d6824f1aa591ccf55616a451d40a82b /kernel/fork.c | |
parent | 08b227d9f380aff229fe7eb3e43c0d90ac14ec38 (diff) | |
download | linux-stable-3fe0ed7bd7329e28aca7cdaf7353c6d4778b3d41.tar.gz linux-stable-3fe0ed7bd7329e28aca7cdaf7353c6d4778b3d41.tar.bz2 linux-stable-3fe0ed7bd7329e28aca7cdaf7353c6d4778b3d41.zip |
futex: Move futex exit handling into futex code
commit ba31c1a48538992316cc71ce94fa9cd3e7b427c0 upstream
The futex exit handling is #ifdeffed into mm_release() which is not pretty
to begin with. But upcoming changes to address futex exit races need to add
more functionality to this exit code.
Split it out into a function, move it into futex code and make the various
futex exit functions static.
Preparatory only and no functional change.
Folded build fix from Borislav.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20191106224556.049705556@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index f2c92c100194..ee83f4ee5616 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -1220,20 +1220,7 @@ static int wait_for_vfork_done(struct task_struct *child, void mm_release(struct task_struct *tsk, struct mm_struct *mm) { /* Get rid of any futexes when releasing the mm */ -#ifdef CONFIG_FUTEX - if (unlikely(tsk->robust_list)) { - exit_robust_list(tsk); - tsk->robust_list = NULL; - } -#ifdef CONFIG_COMPAT - if (unlikely(tsk->compat_robust_list)) { - compat_exit_robust_list(tsk); - tsk->compat_robust_list = NULL; - } -#endif - if (unlikely(!list_empty(&tsk->pi_state_list))) - exit_pi_state_list(tsk); -#endif + futex_mm_release(tsk); uprobe_free_utask(tsk); @@ -1937,14 +1924,8 @@ static __latent_entropy struct task_struct *copy_process( #ifdef CONFIG_BLOCK p->plug = NULL; #endif -#ifdef CONFIG_FUTEX - p->robust_list = NULL; -#ifdef CONFIG_COMPAT - p->compat_robust_list = NULL; -#endif - INIT_LIST_HEAD(&p->pi_state_list); - p->pi_state_cache = NULL; -#endif + futex_init_task(p); + /* * sigaltstack should be cleared when sharing the same VM */ |