函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:__test_cycle

函数原型:static int __test_cycle(unsigned int nthreads)

返回类型:int

参数:

类型参数名称
unsigned intnthreads
278  last等于nthreads减1
281  cycles等于分配数组内存
282  如果非cycles则返回:负ENOMEM
285 n小于nthreads循环
286  cycle等于cycles[n]
288  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.
289  如果n恒等于lastb_mutex等于a_mutex
291  否则b_mutex等于a_mutex
294  如果n恒等于0则a_signal等于b_signal
296  否则a_signal等于b_signal
298  init_completion( & b_signal)
300  INIT_WORK( & work, test_cycle_work)
301  result等于0
304 n小于nthreads循环queue_work - queue work on a workqueue*@wq: workqueue to use*@work: work to queue* Returns %false if @work was already on a queue, %true otherwise.* We queue the work to the CPU on which it was submitted, but if the CPU dies
307  lush_workqueue - ensure that any scheduled work has run to completion.*@wq: workqueue to flush* This function sleeps until all work items which were queued on entry* have finished execution, but it is not livelocked by new incoming ones.
309  ret等于0
310 n小于nthreads循环
311  cycle等于cycles[n]
313  如果非result则继续下一循环
316  打印错误信息("cyclic deadlock not resolved, ret[%d/%d] = %d\n", n, nthreads, result)
318  ret等于负EINVAL
319  退出
322 n小于nthreads循环ww_mutex_destroy - mark a w/w mutex unusable*@lock: the mutex to be destroyed* This function marks the mutex uninitialized, and any subsequent* use of the mutex is forbidden. The mutex must not be locked when* this function is called.
324  释放内存
325  返回:ret
调用者
名称描述
test_cycle