locking/ww_mutex: Simplify use_ww_ctx & ww_ctx handling
authorWaiman Long <longman@redhat.com>
Tue, 16 Mar 2021 15:31:16 +0000 (11:31 -0400)
committerIngo Molnar <mingo@kernel.org>
Wed, 17 Mar 2021 08:56:44 +0000 (09:56 +0100)
commit5de2055d31ea88fd9ae9709ac95c372a505a60fa
tree627aa968324f0a86a045733abb7721a4f9aca914
parent1df27313f50a57497c1faeb6a6ae4ca939c85a7d
locking/ww_mutex: Simplify use_ww_ctx & ww_ctx handling

The use_ww_ctx flag is passed to mutex_optimistic_spin(), but the
function doesn't use it. The frequent use of the (use_ww_ctx && ww_ctx)
combination is repetitive.

In fact, ww_ctx should not be used at all if !use_ww_ctx.  Simplify
ww_mutex code by dropping use_ww_ctx from mutex_optimistic_spin() an
clear ww_ctx if !use_ww_ctx. In this way, we can replace (use_ww_ctx &&
ww_ctx) by just (ww_ctx).

Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Davidlohr Bueso <dbueso@suse.de>
Link: https://lore.kernel.org/r/20210316153119.13802-2-longman@redhat.com
kernel/locking/mutex.c