diff options
author | Kefeng Wang <wangkefeng.wang@huawei.com> | 2021-12-03 10:59:34 +0300 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2021-12-04 12:56:25 +0300 |
commit | c0bed69daf4b67809b58cc7cd81a8fa4f45bc161 (patch) | |
tree | 2e5eac02c318c1145dace9791e1e53b74ca0dc49 /kernel/locking/rwsem.c | |
parent | 9a75bd0c52df6cff44735f73dfb9d00e67969fc5 (diff) | |
download | linux-c0bed69daf4b67809b58cc7cd81a8fa4f45bc161.tar.xz |
locking: Make owner_on_cpu() into <linux/sched.h>
Move the owner_on_cpu() from kernel/locking/rwsem.c into
include/linux/sched.h with under CONFIG_SMP, then use it
in the mutex/rwsem/rtmutex to simplify the code.
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20211203075935.136808-2-wangkefeng.wang@huawei.com
Diffstat (limited to 'kernel/locking/rwsem.c')
-rw-r--r-- | kernel/locking/rwsem.c | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c index c51387a43265..b92d0a830568 100644 --- a/kernel/locking/rwsem.c +++ b/kernel/locking/rwsem.c @@ -613,15 +613,6 @@ static inline bool rwsem_try_write_lock_unqueued(struct rw_semaphore *sem) return false; } -static inline bool owner_on_cpu(struct task_struct *owner) -{ - /* - * As lock holder preemption issue, we both skip spinning if - * task is not on cpu or its cpu is preempted - */ - return owner->on_cpu && !vcpu_is_preempted(task_cpu(owner)); -} - static inline bool rwsem_can_spin_on_owner(struct rw_semaphore *sem) { struct task_struct *owner; |