WORKER_THREAD

포스트: 7|아이템:W(955)
Tags

Posts

7 posts

[라즈베리파이] 워크큐(Workqueue) - worker_thread() 함수 분석(3)

Guillermo Austin Kim|2018년 9월 16일

Contents of tableworker_thread() 함수 분석(1)worker_thread() 함수 분석(2)worker_thread() 함수 분석(3) 이번에는 worker_thread() 함수에서 가장 중요한 37번 줄 코드를 분석할 차례입니다. 위 그림에서 워커 쓰레드의 “실행” 단계입니다. 코드를 봅시다.37do {38struct work_struct *work =39list_first_entry(&pool->worklist,40 struct work_struct, entry);4142pool->watchdog_ts = jiffies;4344if (likely(!(*work_data_bits(work) & WORK_STRUCT_

[라즈베리파이] 워크큐(Workqueue) - worker_thread() 함수 분석(2)

Guillermo Austin Kim|2018년 9월 13일

먼저 워커 쓰레드 핸들 함수인 worker_thread() 를 분석합니다.1 static int worker_thread(void *__worker)2 {3struct worker *worker = __worker;4struct worker_pool *pool = worker->pool;56worker->task->flags |= PF_WQ_WORKER;7 woke_up:8spin_lock_irq(&pool->lock);910/* am I supposed to die? */11if (unlikely(worker->flags & WORKER_DIE)) {12spin_unlock_irq(&pool->lock);13WARN_ON_ONCE(!l

[라즈베리파이][리눅스커널] 워크큐(Workqueue) - worker_thread() 함수 분석(1)

Guillermo Austin Kim|2018년 9월 12일

워크는 워커 쓰레드가 실행합니다. 워커 쓰레드를 관리하는 자료구조는 struct worker 구조체이며 이를 워커라고 부릅니다. 이전까지 자료구조 중심으로 워크를 분석했는데 이번에는 워커 쓰레드가 쓰레드 관점으로 어떻게 실행하는지 알아봅니다. 다음은 워커 자료구조인 struct worker 구조체 선언부입니다.[https://elixir.bootlin.com/linux/v4.14.43/source/kernel/workqueue_internal.h#L24]1 struct worker {2 union {3 struct list_head entry; 4 struct hlist_node hentry; 5 };6 struct work_struct *current_work; 7 work_func_t curre