Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\locking\test-ww_mutex.c Create Date:2022-07-28 09:55:06
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:__test_cycle

Proto:static int __test_cycle(unsigned int nthreads)

Type:int

Parameter:

TypeParameterName
unsigned intnthreads
278  last = nthreads - 1
281  cycles = kmalloc_array - allocate memory for an array.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
282  If Not cycles Then Return -ENOMEM
285  When n < nthreads cycle
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  If n == last Then b_mutex = a_mutex
291  Else b_mutex = a_mutex
294  If n == 0 Then a_signal = b_signal
296  Else a_signal = b_signal
298  init_completion( & b_signal)
300  INIT_WORK( & work, test_cycle_work)
301  result = 0
304  When n < nthreads cycle 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  When n < nthreads cycle
311  cycle = cycles[n]
313  If Not result Then Continue
316  pr_err("cyclic deadlock not resolved, ret[%d/%d] = %d\n", n, nthreads, result)
318  ret = -EINVAL
319  Break
322  When n < nthreads cycle 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  kfree - free previously allocated memory*@objp: pointer returned by kmalloc.* If @objp is NULL, no operation is performed.* Don't free memory not originally allocated by kmalloc()* or you will run into trouble.
325  Return ret
Caller
NameDescribe
test_cycle