futex: Replace PF_EXITPIDONE with a state
authorThomas Gleixner <tglx@linutronix.de>
Wed, 6 Nov 2019 21:55:37 +0000 (22:55 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Nov 2019 09:10:09 +0000 (10:10 +0100)
commit52507cfaffe900c4d23931e9863bd54b4b980d65
tree38d86c0fbca6b9e4577677ffa2121701e9e767e7
parent8012f98f92b6567ad42e2dec1d2d3739df1c5f96
futex: Replace PF_EXITPIDONE with a state

commit 3d4775df0a89240f671861c6ab6e8d59af8e9e41 upstream.

The futex exit handling relies on PF_ flags. That's suboptimal as it
requires a smp_mb() and an ugly lock/unlock of the exiting tasks pi_lock in
the middle of do_exit() to enforce the observability of PF_EXITING in the
futex code.

Add a futex_state member to task_struct and convert the PF_EXITPIDONE logic
over to the new state. The PF_EXITING dependency will be cleaned up in a
later step.

This prepares for handling various futex exit issues later.

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.149449274@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/futex.h
include/linux/sched.h
kernel/exit.c
kernel/futex.c