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