Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

locking/rwsem: Use OWNER_NONSPINNABLE directly instead of OWNER_SPINNABLE

After commit 7d43f1ce9dd0 ("locking/rwsem: Enable time-based spinning on
reader-owned rwsem"), OWNER_SPINNABLE contains all possible values except
OWNER_NONSPINNABLE, namely OWNER_NULL | OWNER_WRITER | OWNER_READER.

Therefore, it is better to use OWNER_NONSPINNABLE directly to determine
whether to exit optimistic spin.

And, remove useless OWNER_SPINNABLE to simplify the code.

Signed-off-by: Jinliang Zheng <alexjlzheng@tencent.com>
Acked-by: Waiman Long <longman@redhat.com>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Link: https://lore.kernel.org/r/20250610130158.4876-1-alexjlzheng@tencent.com

authored by

Jinliang Zheng and committed by
Boqun Feng
f84a15b9 99214efe

+1 -3
+1 -3
kernel/locking/rwsem.c
··· 727 727 return ret; 728 728 } 729 729 730 - #define OWNER_SPINNABLE (OWNER_NULL | OWNER_WRITER | OWNER_READER) 731 - 732 730 static inline enum owner_state 733 731 rwsem_owner_state(struct task_struct *owner, unsigned long flags) 734 732 { ··· 833 835 enum owner_state owner_state; 834 836 835 837 owner_state = rwsem_spin_on_owner(sem); 836 - if (!(owner_state & OWNER_SPINNABLE)) 838 + if (owner_state == OWNER_NONSPINNABLE) 837 839 break; 838 840 839 841 /*