]> git.baikalelectronics.ru Git - kernel.git/commit
locking/ww_mutex: Replace cpu_relax() with cond_resched() for tests
authorChris Wilson <chris@chris-wilson.co.uk>
Tue, 28 Feb 2017 09:40:11 +0000 (09:40 +0000)
committerIngo Molnar <mingo@kernel.org>
Thu, 2 Mar 2017 08:00:38 +0000 (09:00 +0100)
commitb4c2b2fde7162caaf0dc469fc34716b5085a003e
tree14dbb66a5e79dd4083f79040b208411dcba8a442
parentf26f1def03a38c041f90e46202551e1039ec0008
locking/ww_mutex: Replace cpu_relax() with cond_resched() for tests

When busy-spinning on a ww_mutex_trylock(), we depend upon the other
thread advancing and releasing the lock. This can not happen on a single
CPU unless we relinquish it:

  [ ] NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [kworker/0:1:18]
  ...
  [ ] Call Trace:
  [ ]  mutex_trylock()
  [ ]  test_mutex_work+0x31/0x56
  [ ]  process_one_work+0x1b4/0x2f9
  [ ]  worker_thread+0x1b0/0x27c
  [ ]  kthread+0xd1/0xd3
  [ ]  ret_from_fork+0x19/0x30

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 92a605b58b21 ("locking/ww_mutex: Begin kselftests for ww_mutex")
Link: http://lkml.kernel.org/r/20170228094011.2595-1-chris@chris-wilson.co.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/locking/test-ww_mutex.c