函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:scuer_thread - the rescuer thread function*@__rescuer: self* Workqueue rescuer thread function

函数原型:static int rescuer_thread(void *__rescuer)

返回类型:int

参数:

类型参数名称
void *__rescuer
2458  rescuer等于__rescuer
2459  wq等于I: the workqueue to rescue
2460  scheduled等于L: scheduled works
2463  set_user_nice(当前进程, 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  当非链表为空循环
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;* (就绪态)
2494  删除链表项并重新初始化
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(!链表为空)
2508  如果get_work_pwq(work)恒等于pwq
2509  如果firstL: watchdog timestamp 等于jiffies
2513  first = false
2516  如果非链表为空
2517  process_scheduled_works - process scheduled works*@worker: self* Process all scheduled works
2529  加自旋锁
2534  如果MD: rescue worker 链表为空
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  如果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.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  如果should_stop
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;* (就绪态)
2567  set_pf_worker(false)
2568  返回:0
2572  WARN_ON_ONCE(!(X: flags & WORKER_NOT_RUNNING))
2573  schedule()
2574  转到:repeat