Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:worker_thread

Proto:static int worker_thread(void *__worker)

Type:int

Parameter:

TypeParameterName
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  If Value for the false possibility is greater at compile time(X: flags & WORKER_DIE) Then
2364  spin_unlock_irq( & he pool lock )
2365  WARN_ON_ONCE(!list_empty - tests whether a list is empty*@head: the list to test.)
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  free previously allocated memory
2372  Return 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  If Not 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 Go to sleep
2382  If Value for the false possibility is greater at compile time(!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. Then Go to recheck
2390  WARN_ON_ONCE(!list_empty - tests whether a list is empty*@head: the list to test.)
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  Do
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  Else
2417  When Do I need to keep working? Called from currently running workers. cycle
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  Go to woke_up