History

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.

Tejun Heo committed 11 years ago

Commit 2607d7a1 parent e2dca7a1 file · +5 −0Browse files

Showing the changes to kernel/workqueue.c (1 of 1 file). Show all

Unified · Split

kernel/workqueue.c+5−0
@@ -159,6 +159,7 @@ struct worker_pool { · 158 unmodified lines
159159
160160 /* see manage_workers() for details on the two manager mutexes */
161161 struct mutex manager_arb; /* manager arbitration */
162+ struct worker *manager; /* L: purely informational */
162163 struct mutex attach_mutex; /* attach/detach exclusion */
163164 struct list_head workers; /* A: attached workers */
164165 struct completion *detach_completion; /* all workers detached */
@@ -1918,9 +1919,11 @@ static bool manage_workers(struct worker *worker) · 1753 unmodified lines
19181919 */
19191920 if (!mutex_trylock(&pool->manager_arb))
19201921 return false;
1922+ pool->manager = worker;
19211923
19221924 maybe_create_worker(pool);
19231925
1926+ pool->manager = NULL;
19241927 mutex_unlock(&pool->manager_arb);
19251928 return true;
19261929 }
@@ -2310,6 +2313,7 @@ repeat: · 383 unmodified lines
23102313 struct wq_barrier {
23112314 struct work_struct work;
23122315 struct completion done;
2316+ struct task_struct *task; /* purely informational */
23132317 };
23142318
23152319 static void wq_barrier_func(struct work_struct *work)
@@ -2358,6 +2362,7 @@ static void insert_wq_barrier(struct pool_workqueue *pwq, · 42 unmodified lines
23582362 INIT_WORK_ONSTACK(&barr->work, wq_barrier_func);
23592363 __set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(&barr->work));
23602364 init_completion(&barr->done);
2365+ barr->task = current;
23612366
23622367 /*
23632368 * If @target is currently being executed, schedule the

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t