hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I7F5L7 CVE: NA
--------------------------------
Revert this patch due to fio performance degradation. This reverts commit 70e33beccb0a795f19594c41dd5be4146f097bca.
Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- kernel/locking/rwsem.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c index 7bf45b0a1b1d..cc5cc889b5b7 100644 --- a/kernel/locking/rwsem.c +++ b/kernel/locking/rwsem.c @@ -273,16 +273,9 @@ static inline void rwsem_set_nonspinnable(struct rw_semaphore *sem) static inline bool rwsem_read_trylock(struct rw_semaphore *sem) { long cnt = atomic_long_add_return_acquire(RWSEM_READER_BIAS, &sem->count); - if (WARN_ON_ONCE(cnt < 0)) rwsem_set_nonspinnable(sem); - - if (!(cnt & RWSEM_READ_FAILED_MASK)) { - rwsem_set_reader_owned(sem); - return true; - } - - return false; + return !(cnt & RWSEM_READ_FAILED_MASK); }
/* @@ -1347,6 +1340,8 @@ static inline void __down_read(struct rw_semaphore *sem) if (!rwsem_read_trylock(sem)) { rwsem_down_read_slowpath(sem, TASK_UNINTERRUPTIBLE); DEBUG_RWSEMS_WARN_ON(!is_rwsem_reader_owned(sem), sem); + } else { + rwsem_set_reader_owned(sem); } }
@@ -1356,6 +1351,8 @@ static inline int __down_read_interruptible(struct rw_semaphore *sem) if (IS_ERR(rwsem_down_read_slowpath(sem, TASK_INTERRUPTIBLE))) return -EINTR; DEBUG_RWSEMS_WARN_ON(!is_rwsem_reader_owned(sem), sem); + } else { + rwsem_set_reader_owned(sem); } return 0; } @@ -1366,6 +1363,8 @@ static inline int __down_read_killable(struct rw_semaphore *sem) if (IS_ERR(rwsem_down_read_slowpath(sem, TASK_KILLABLE))) return -EINTR; DEBUG_RWSEMS_WARN_ON(!is_rwsem_reader_owned(sem), sem); + } else { + rwsem_set_reader_owned(sem); } return 0; }