函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:__test_mutex

函数原型:static int __test_mutex(unsigned int flags)

返回类型:int

参数:

类型参数名称
unsigned intflags
55  ww_mutex_init - initialize the w/w mutex*@lock: the mutex to be initialized*@ww_class: the w/w class the mutex should belong to* Initialize the w/w mutex to unlocked state and associate it with the given* class.
56  ww_acquire_init - initialize a w/w acquire context*@ctx: w/w acquire context to initialize*@ww_class: w/w class of the context* Initializes an context to acquire multiple mutexes of the given w/w class
58  INIT_WORK_ONSTACK( & work, test_mutex_work)
59  init_completion( & ready)
60  init_completion( & go)
61  init_completion( & done)
62  flags等于flags
64  schedule_work - put work task in global workqueue*@work: job to be done* Returns %false if @work was already on the kernel-global workqueue and* %true otherwise
66  wait_for_completion: - waits for completion of a task*@x: holds the state of this particular completion* This waits to be signaled for completion of a specific task. It is NOT* interruptible and there is no timeout.* See also similar routines (i
67  ww_mutex_lock( & mutex, (flags & TEST_MTX_CTX) ? & ctx : NULL)
68  mplete: - signals a single thread waiting on this completion*@x: holds the state of this particular completion* This will wake up a single thread waiting on this completion. Threads will be* awakened in the same order in which they were queued.
69  如果flags按位与TEST_MTX_SPIN
70  timeout等于jiffiesTIMEOUT
72  ret等于0
73  循环
75  ret等于负EINVAL
76  退出
78  cond_resched()
79 time_before(jiffies, timeout)循环
80  否则
81  ret等于wait_for_completion_timeout: - waits for completion of a task (w/timeout)*@x: holds the state of this particular completion*@timeout: timeout value in jiffies* This waits for either a completion of a specific task to be signaled or for a
83  ww_mutex_unlock - release the w/w mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously with any of the* ww_mutex_lock* functions (with or without an acquire context). It is
84  ww_acquire_fini - releases a w/w acquire context*@ctx: the acquire context to free* Releases a w/w acquire context. This must be called _after_ all acquired w/w* mutexes have been released with ww_mutex_unlock.
86  如果ret
87  打印错误信息("%s(flags=%x): mutual exclusion failure\n", __func__, flags)
89  ret等于负EINVAL
92  lush_work - wait for a work to finish executing the last queueing instance*@work: the work to flush* Wait until @work has finished execution
93  destroy_work_on_stack( & work)
94  返回:ret
调用者
名称描述
test_mutex