函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:handle the lock release when processes blocked on it that can now run* - if we come here from up_xxxx(), then the RWSEM_FLAG_WAITERS bit must* have been set

函数原型:static void rwsem_mark_wake(struct rw_semaphore *sem, enum rwsem_wake_type wake_type, struct wake_q_head *wake_q)

返回类型:void

参数:

类型参数名称
struct rw_semaphore *sem
enum rwsem_wake_typewake_type
struct wake_q_head *wake_q
406  woken等于0, adjustment等于0
409  lockdep_assert_held( & wait_lock)
415  waiter等于rwsem_first_waiter(sem)
417  如果type恒等于RWSEM_WAITING_FOR_WRITE
430  返回
436  如果此条件成立可能性小(为编译器优化)(atomic_long_read( & count) < 0)则返回
444  如果wake_type不等于RWSEM_WAKE_READ_OWNED
447  adjustment等于RWSEM_READER_BIAS
448  oldcount等于atomic_long_fetch_add(adjustment, & count)
462  返回
470  owner等于task
471  如果last_rowner按位与RWSEM_RD_NONSPINNABLE
472  owner等于owner按位或RWSEM_RD_NONSPINNABLE
475  The task_struct pointer of the last owning reader will be left in* the owner field.* Note that the owner value just indicates the task has owned the rwsem* previously, it may not be the real owner or one of the real owners
501  初始化链表头
503  如果type恒等于RWSEM_WAITING_FOR_WRITE则继续下一循环
506  woken自加
507  链表项移动到尾部
512  如果woken大于等于Magic number to batch-wakeup waiting readers, even when writers are* also present in the queue. This both limits the amount of work the* waking thread must do and also prevents any potential counter overflow,* however unlikely.退出
516  adjustment等于wokenRWSEM_READER_BIASadjustment
518  如果链表为空
520  adjustment减等于RWSEM_FLAG_WAITERS
527  如果wokenatomic_long_read( & count)按位与RWSEM_FLAG_HANDOFFadjustment减等于RWSEM_FLAG_HANDOFF
530  如果adjustmentatomic_long_add(adjustment, & count)
537  tsk等于task
538  get_task_struct(tsk)
546  smp_store_release( & task, NULL)
551  wake_q_add_safe() - safely queue a wakeup for 'later' waking
调用者
名称描述
rwsem_down_read_slowpathWait for the read lock to be granted
rwsem_down_write_slowpathWait until we successfully acquire the write lock
rwsem_wakehandle waking up a waiter on the semaphore* - up_read/up_write has decremented the active part of count if we come here
rwsem_downgrade_wakedowngrade a write lock into a read lock* - caller incremented waiting part of count and discovered it still negative* - just wake up any readers at the front of the queue