Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

workqueue: keep track of the flushing task and pool manager

Add wq_barrier->task and worker_pool->manager to keep track of the
flushing task and pool manager respectively. These are purely
informational and will be used to implement sysrq dump of workqueues.

Signed-off-by: Tejun Heo <tj@kernel.org>

Tejun Heo 2607d7a6 e2dca7ad

+5
+5
kernel/workqueue.c
··· 159 159 160 160 /* see manage_workers() for details on the two manager mutexes */ 161 161 struct mutex manager_arb; /* manager arbitration */ 162 + struct worker *manager; /* L: purely informational */ 162 163 struct mutex attach_mutex; /* attach/detach exclusion */ 163 164 struct list_head workers; /* A: attached workers */ 164 165 struct completion *detach_completion; /* all workers detached */ ··· 1919 1918 */ 1920 1919 if (!mutex_trylock(&pool->manager_arb)) 1921 1920 return false; 1921 + pool->manager = worker; 1922 1922 1923 1923 maybe_create_worker(pool); 1924 1924 1925 + pool->manager = NULL; 1925 1926 mutex_unlock(&pool->manager_arb); 1926 1927 return true; 1927 1928 } ··· 2313 2310 struct wq_barrier { 2314 2311 struct work_struct work; 2315 2312 struct completion done; 2313 + struct task_struct *task; /* purely informational */ 2316 2314 }; 2317 2315 2318 2316 static void wq_barrier_func(struct work_struct *work) ··· 2362 2358 INIT_WORK_ONSTACK(&barr->work, wq_barrier_func); 2363 2359 __set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(&barr->work)); 2364 2360 init_completion(&barr->done); 2361 + barr->task = current; 2365 2362 2366 2363 /* 2367 2364 * If @target is currently being executed, schedule the