Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:drain_workqueue - drain a workqueue*@wq: workqueue to drain* Wait until the workqueue becomes empty. While draining is in progress,* only chain queueing is allowed. IOW, only currently pending or running

Proto:void drain_workqueue(struct workqueue_struct *wq)

Type:void

Parameter:

TypeParameterName
struct workqueue_struct *wq
2927  flush_cnt = 0
2935  mutex_lock( & protects this wq )
2936  If Not WQ: drain in progress ++ Then hot fields used during command issue, aligned to cacheline |= __WQ_DRAINING
2938  mutex_unlock( & protects this wq )
2939  reflush :
2940  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.
2942  mutex_lock( & protects this wq )
2944  r_each_pwq - iterate through all pool_workqueues of the specified workqueue*@pwq: iteration cursor*@wq: the target workqueue* This must be called either with wq->mutex held or RCU read locked(pwq, wq)
2947  spin_lock_irq( & he pool lock )
2948  drained = Not L: nr of active works && list_empty - tests whether a list is empty*@head: the list to test.
2949  spin_unlock_irq( & he pool lock )
2951  If drained Then Continue
2954  If ++flush_cnt == 10 || flush_cnt % 100 == 0 && flush_cnt <= 1000 Then pr_warn("workqueue %s: drain_workqueue() isn't complete after %u tries\n", I: workqueue name , flush_cnt)
2959  mutex_unlock( & protects this wq )
2960  Go to reflush
2963  If Not --WQ: drain in progress Then hot fields used during command issue, aligned to cacheline &= ~__WQ_DRAINING
2965  mutex_unlock( & protects this wq )
Caller
NameDescribe
destroy_workqueuedestroy_workqueue - safely terminate a workqueue*@wq: target workqueue* Safely destroy a workqueue. All work currently pending will be done first.