Merge branch 'core-locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull core locking updates from Ingo Molnar: "The biggest change is the MCS spinlock generalization changes from Tim Chen, Peter Zijlstra, Jason Low et al. There's also lockdep fixes/enhancements from Oleg Nesterov, in particular a false negative fix related to lockdep_set_novalidate_class() usage" * 'core-locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (22 commits) locking/mutex: Fix debug checks locking/mutexes: Add extra reschedule point locking/mutexes: Introduce cancelable MCS lock for adaptive spinning locking/mutexes: Unlock the mutex without the wait_lock locking/mutexes: Modify the way optimistic spinners are queued locking/mutexes: Return false if task need_resched() in mutex_can_spin_on_owner() locking: Move mcs_spinlock.h into kernel/locking/ m68k: Skip futex_atomic_cmpxchg_inatomic() test futex: Allow architectures to skip futex_atomic_cmpxchg_inatomic() test Revert "sched/wait: Suppress Sparse 'variable shadowing' warning" lockdep: Change lockdep_set_novalidate_class() to use _and_name lockdep: Change mark_held_locks() to check hlock->check instead of lockdep_no_validate lockdep: Don't create the wrong dependency on hlock->check == 0 lockdep: Make held_lock->check and "int check" argument bool locking/mcs: Allow architecture specific asm files to be used for contended case locking/mcs: Order the header files in Kbuild of each architecture in alphabetical order sched/wait: Suppress Sparse 'variable shadowing' warning hung_task/Documentation: Fix hung_task_warnings description locking/mcs: Allow architectures to hook in to contended paths locking/mcs: Micro-optimize the MCS code, add extra comments ...
This commit is contained in:
@@ -157,7 +157,9 @@
|
||||
* enqueue.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_HAVE_FUTEX_CMPXCHG
|
||||
int __read_mostly futex_cmpxchg_enabled;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Futex flags used to encode options to functions and preserve them across
|
||||
@@ -2875,9 +2877,28 @@ SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
|
||||
return do_futex(uaddr, op, val, tp, uaddr2, val2, val3);
|
||||
}
|
||||
|
||||
static void __init futex_detect_cmpxchg(void)
|
||||
{
|
||||
#ifndef CONFIG_HAVE_FUTEX_CMPXCHG
|
||||
u32 curval;
|
||||
|
||||
/*
|
||||
* This will fail and we want it. Some arch implementations do
|
||||
* runtime detection of the futex_atomic_cmpxchg_inatomic()
|
||||
* functionality. We want to know that before we call in any
|
||||
* of the complex code paths. Also we want to prevent
|
||||
* registration of robust lists in that case. NULL is
|
||||
* guaranteed to fault and we get -EFAULT on functional
|
||||
* implementation, the non-functional ones will return
|
||||
* -ENOSYS.
|
||||
*/
|
||||
if (cmpxchg_futex_value_locked(&curval, NULL, 0, 0) == -EFAULT)
|
||||
futex_cmpxchg_enabled = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
static int __init futex_init(void)
|
||||
{
|
||||
u32 curval;
|
||||
unsigned int futex_shift;
|
||||
unsigned long i;
|
||||
|
||||
@@ -2893,18 +2914,8 @@ static int __init futex_init(void)
|
||||
&futex_shift, NULL,
|
||||
futex_hashsize, futex_hashsize);
|
||||
futex_hashsize = 1UL << futex_shift;
|
||||
/*
|
||||
* This will fail and we want it. Some arch implementations do
|
||||
* runtime detection of the futex_atomic_cmpxchg_inatomic()
|
||||
* functionality. We want to know that before we call in any
|
||||
* of the complex code paths. Also we want to prevent
|
||||
* registration of robust lists in that case. NULL is
|
||||
* guaranteed to fault and we get -EFAULT on functional
|
||||
* implementation, the non-functional ones will return
|
||||
* -ENOSYS.
|
||||
*/
|
||||
if (cmpxchg_futex_value_locked(&curval, NULL, 0, 0) == -EFAULT)
|
||||
futex_cmpxchg_enabled = 1;
|
||||
|
||||
futex_detect_cmpxchg();
|
||||
|
||||
for (i = 0; i < futex_hashsize; i++) {
|
||||
atomic_set(&futex_queues[i].waiters, 0);
|
||||
|
Reference in New Issue
Block a user