函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\locking\rwsem.c Create Date:2022-07-27 10:48:31
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:This function must be called with the sem->wait_lock held to prevent* race conditions between checking the rwsem wait list and setting the* If wstate is WRITER_HANDOFF, it will make sure that either the handoff

函数原型:static inline bool rwsem_try_write_lock(struct rw_semaphore *sem, enum writer_wait_state wstate)

返回类型:bool

参数:

类型参数名称
struct rw_semaphore *sem>count accordingly.
enum writer_wait_statewstate
568  lockdep_assert_held( & wait_lock)
570  count等于atomic_long_read( & count)
571  循环
572  has_handoff等于非非count按位与RWSEM_FLAG_HANDOFF的值
574  如果has_handoffwstate恒等于 Writer is not first in wait list 则返回:false
577  new等于count
579  如果count按位与RWSEM_LOCK_MASK
580  如果has_handoffwstate不等于WRITER_HANDOFF则返回:false
583  new或等于RWSEM_FLAG_HANDOFF
584  否则
586  new与等于RWSEM_FLAG_HANDOFF的反
588  如果链表只有一项new与等于RWSEM_FLAG_WAITERS的反
591  当非atomic_long_try_cmpxchg_acquire( & count, & count, new)循环
597  如果new按位与RWSEM_FLAG_HANDOFF则返回:false
600  All writes to owner are protected by WRITE_ONCE() to make sure that* store tearing can't happen as optimistic spinners may read and use* the owner value concurrently without lock
601  返回:true
调用者
名称描述
rwsem_down_write_slowpathWait until we successfully acquire the write lock