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.
Showing the changes to kernel/workqueue.c (1 of 1 file). Show all
Unified · Split
| @@ -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 | |||
| 2310 | struct wq_barrier { | 2313 | struct 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 | ||
| 2315 | static void wq_barrier_func(struct work_struct *work) | 2319 | 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 | |||
| 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 the | 2368 | * If @target is currently being executed, schedule the |