函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:worker_thread

函数原型:static int worker_thread(void *__worker)

返回类型:int

参数:

类型参数名称
void *__worker
2354  worker等于__worker
2355  pool等于A: the associated pool
2358  set_pf_worker(true)
2359  woke_up :
2360  spin_lock_irq( & he pool lock )
2363  如果此条件成立可能性小(为编译器优化)(X: flags & WORKER_DIE)则
2364  spin_unlock_irq( & he pool lock )
2365  WARN_ON_ONCE(!链表为空)
2366  set_pf_worker(false)
2368  set_task_comm(I: worker task , "kworker/dying")
2369  ida_simple_remove( & worker IDs for task name , I: worker id )
2370  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
2371  释放内存
2372  返回:0
2375  worker_leave_idle - leave idle state*@worker: worker which is leaving idle state*@worker is leaving idle state. Update stats.* LOCKING:* spin_lock_irq(pool->lock).
2376  recheck :
2378  如果非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.则转到:sleep
2382  如果此条件成立可能性小(为编译器优化)(!Can I start working? Called from busy but !running workers. )且manage_workers - manage worker pool*@worker: self* Assume the manager role and manage the worker pool @worker belongs* to. At any given time, there can be only zero or one manager per* pool. The exclusion is handled automatically by this function.则转到:recheck
2390  WARN_ON_ONCE(!链表为空)
2399  worker_clr_flags - clear worker flags and adjust nr_running accordingly*@worker: self*@flags: flags to clear* Clear @flags in @worker->flags and adjust nr_running accordingly.* CONTEXT:* spin_lock_irq(pool->lock)
2401  循环
2402  work等于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.( & L: list of pending works , structwork_struct, entry)
2406  L: watchdog timestamp 等于jiffies
2413  否则
2417 Do I need to keep working? Called from currently running workers. 循环
2419  worker_set_flags - set worker flags and adjust nr_running accordingly*@worker: self*@flags: flags to set* Set @flags in @worker->flags and adjust nr_running accordingly.* CONTEXT:* spin_lock_irq(pool->lock)
2420  sleep :
2428  worker_enter_idle - enter idle state*@worker: worker which is entering idle state*@worker is entering idle state. Update stats and idle timer if* necessary.* LOCKING:* spin_lock_irq(pool->lock).
2429  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;* (TASK_IDLE)
2430  spin_unlock_irq( & he pool lock )
2431  schedule()
2432  转到:woke_up