Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:scuer_thread - the rescuer thread function*@__rescuer: self* Workqueue rescuer thread function

Proto:static int rescuer_thread(void *__rescuer)

Type:int

Parameter:

TypeParameterName
void *__rescuer
2458  rescuer = __rescuer
2459  wq = I: the workqueue to rescue
2460  scheduled = L: scheduled works
2463  set_user_nice(current process, RESCUER_NICE_LEVEL)
2469  set_pf_worker(true)
2470  repeat :
2471  set_current_state(TASK_IDLE)
2481  should_stop = kthread_should_stop()
2484  spin_lock_irq( & wq_mayday_lock)
2486  When Not list_empty - tests whether a list is empty*@head: the list to test. cycle
2487  pwq = list_first_entry - get the first element from a list*@ptr: the list head to take the element from.*@type: the type of the struct this is embedded in.*@member: the name of the list_head within the struct.* Note, that list is expected to be not empty.( & MD: pwqs requesting rescue , structpool_workqueue, mayday_node)
2489  pool = I: the associated pool
2491  bool first = true
2493  set_current_state() includes a barrier so that the write of current->state* is correctly serialised wrt the caller's subsequent test of whether to* actually sleep:* for (;;) {* set_current_state(TASK_UNINTERRUPTIBLE);* if (!need_sleep)* break;* (Used in tsk->state: )
2494  list_del_init - deletes entry from list and reinitialize it.*@entry: the element to delete from the list.
2496  spin_unlock_irq( & wq_mayday_lock)
2498  worker_attach_to_pool() - attach a worker to a pool*@worker: worker to be attached*@pool: the target pool* Attach @worker to @pool. Once attached, the %WORKER_UNBOUND flag and* cpu-binding of @worker are kept coordinated with the pool across
2500  spin_lock_irq( & he pool lock )
2506  WARN_ON_ONCE(!list_empty - tests whether a list is empty*@head: the list to test.)
2508  If get_work_pwq(work) == pwq Then
2513  first = false
2516  If Not list_empty - tests whether a list is empty*@head: the list to test. Then
2517  process_scheduled_works - process scheduled works*@worker: self* Process all scheduled works
2546  put_pwq - put a pool_workqueue reference*@pwq: pool_workqueue to put* Drop a reference of @pwq. If its refcnt reaches zero, schedule its* destruction. The caller should be holding the matching pool->lock.
2553  If Need to wake up a worker? Called from anything but currently* running workers.* Note that, because unbound workers never contribute to nr_running, this* function will always return %true for unbound pools as long as the* worklist isn't empty. Then wake_up_worker - wake up an idle worker*@pool: worker pool to wake worker from* Wake up the first idle worker of @pool.* CONTEXT:* spin_lock_irq(pool->lock).
2556  spin_unlock_irq( & he pool lock )
2558  worker_detach_from_pool() - detach a worker from its pool*@worker: worker which is attached to its pool* Undo the attaching which had been done in worker_attach_to_pool(). The* caller worker shouldn't access to the pool after detached except it has
2560  spin_lock_irq( & wq_mayday_lock)
2563  spin_unlock_irq( & wq_mayday_lock)
2565  If should_stop Then
2566  set_current_state() includes a barrier so that the write of current->state* is correctly serialised wrt the caller's subsequent test of whether to* actually sleep:* for (;;) {* set_current_state(TASK_UNINTERRUPTIBLE);* if (!need_sleep)* break;* (Used in tsk->state: )
2567  set_pf_worker(false)
2568  Return 0
2572  WARN_ON_ONCE(!(X: flags & WORKER_NOT_RUNNING))
2573  schedule()
2574  Go to repeat