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:19
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:stress

Proto:static int stress(int nlocks, int nthreads, unsigned int flags)

Type:int

Parameter:

TypeParameterName
intnlocks
intnthreads
unsigned intflags
529  locks = kmalloc_array - allocate memory for an array.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
530  If Not locks Then Return -ENOMEM
533  When n < nlocks cycle 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.
536  When nthreads cycle
538  void( * fn)(struct work_struct * work)
540  fn = NULL
542  Case & == 0
545  Break
546  Case & == 1
549  Break
550  Case & == 2
551  If flags & STRESS_ONE Then fn = stress_one_work
553  Break
556  If Not fn Then Continue
559  stress = Allocation memory
560  If Not stress Then Break
563  INIT_WORK( & work, fn)
564  locks = locks
565  nlocks = nlocks
566  timeout = jiffies + 2 * HZ
568  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
569  nthreads--
572  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.
574  When n < nlocks 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.
576  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.
578  Return 0
Caller
NameDescribe
test_ww_mutex_init