aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/workqueue.c42
1 files changed, 25 insertions, 17 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 4190e84cf995..16ce617974d2 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -210,6 +210,13 @@ struct workqueue_struct {
210#endif 210#endif
211}; 211};
212 212
213struct workqueue_struct *system_wq __read_mostly;
214struct workqueue_struct *system_long_wq __read_mostly;
215struct workqueue_struct *system_nrt_wq __read_mostly;
216EXPORT_SYMBOL_GPL(system_wq);
217EXPORT_SYMBOL_GPL(system_long_wq);
218EXPORT_SYMBOL_GPL(system_nrt_wq);
219
213#define for_each_busy_worker(worker, i, pos, gcwq) \ 220#define for_each_busy_worker(worker, i, pos, gcwq) \
214 for (i = 0; i < BUSY_WORKER_HASH_SIZE; i++) \ 221 for (i = 0; i < BUSY_WORKER_HASH_SIZE; i++) \
215 hlist_for_each_entry(worker, pos, &gcwq->busy_hash[i], hentry) 222 hlist_for_each_entry(worker, pos, &gcwq->busy_hash[i], hentry)
@@ -2306,8 +2313,6 @@ int cancel_delayed_work_sync(struct delayed_work *dwork)
2306} 2313}
2307EXPORT_SYMBOL(cancel_delayed_work_sync); 2314EXPORT_SYMBOL(cancel_delayed_work_sync);
2308 2315
2309static struct workqueue_struct *keventd_wq __read_mostly;
2310
2311/** 2316/**
2312 * schedule_work - put work task in global workqueue 2317 * schedule_work - put work task in global workqueue
2313 * @work: job to be done 2318 * @work: job to be done
@@ -2321,7 +2326,7 @@ static struct workqueue_struct *keventd_wq __read_mostly;
2321 */ 2326 */
2322int schedule_work(struct work_struct *work) 2327int schedule_work(struct work_struct *work)
2323{ 2328{
2324 return queue_work(keventd_wq, work); 2329 return queue_work(system_wq, work);
2325} 2330}
2326EXPORT_SYMBOL(schedule_work); 2331EXPORT_SYMBOL(schedule_work);
2327 2332
@@ -2334,7 +2339,7 @@ EXPORT_SYMBOL(schedule_work);
2334 */ 2339 */
2335int schedule_work_on(int cpu, struct work_struct *work) 2340int schedule_work_on(int cpu, struct work_struct *work)
2336{ 2341{
2337 return queue_work_on(cpu, keventd_wq, work); 2342 return queue_work_on(cpu, system_wq, work);
2338} 2343}
2339EXPORT_SYMBOL(schedule_work_on); 2344EXPORT_SYMBOL(schedule_work_on);
2340 2345
@@ -2349,7 +2354,7 @@ EXPORT_SYMBOL(schedule_work_on);
2349int schedule_delayed_work(struct delayed_work *dwork, 2354int schedule_delayed_work(struct delayed_work *dwork,
2350 unsigned long delay) 2355 unsigned long delay)
2351{ 2356{
2352 return queue_delayed_work(keventd_wq, dwork, delay); 2357 return queue_delayed_work(system_wq, dwork, delay);
2353} 2358}
2354EXPORT_SYMBOL(schedule_delayed_work); 2359EXPORT_SYMBOL(schedule_delayed_work);
2355 2360
@@ -2382,7 +2387,7 @@ EXPORT_SYMBOL(flush_delayed_work);
2382int schedule_delayed_work_on(int cpu, 2387int schedule_delayed_work_on(int cpu,
2383 struct delayed_work *dwork, unsigned long delay) 2388 struct delayed_work *dwork, unsigned long delay)
2384{ 2389{
2385 return queue_delayed_work_on(cpu, keventd_wq, dwork, delay); 2390 return queue_delayed_work_on(cpu, system_wq, dwork, delay);
2386} 2391}
2387EXPORT_SYMBOL(schedule_delayed_work_on); 2392EXPORT_SYMBOL(schedule_delayed_work_on);
2388 2393
@@ -2447,7 +2452,7 @@ int schedule_on_each_cpu(work_func_t func)
2447 */ 2452 */
2448void flush_scheduled_work(void) 2453void flush_scheduled_work(void)
2449{ 2454{
2450 flush_workqueue(keventd_wq); 2455 flush_workqueue(system_wq);
2451} 2456}
2452EXPORT_SYMBOL(flush_scheduled_work); 2457EXPORT_SYMBOL(flush_scheduled_work);
2453 2458
@@ -2479,7 +2484,7 @@ EXPORT_SYMBOL_GPL(execute_in_process_context);
2479 2484
2480int keventd_up(void) 2485int keventd_up(void)
2481{ 2486{
2482 return keventd_wq != NULL; 2487 return system_wq != NULL;
2483} 2488}
2484 2489
2485static struct cpu_workqueue_struct *alloc_cwqs(void) 2490static struct cpu_workqueue_struct *alloc_cwqs(void)
@@ -2539,15 +2544,16 @@ static int wq_clamp_max_active(int max_active, const char *name)
2539 return clamp_val(max_active, 1, WQ_MAX_ACTIVE); 2544 return clamp_val(max_active, 1, WQ_MAX_ACTIVE);
2540} 2545}
2541 2546
2542struct workqueue_struct *__create_workqueue_key(const char *name, 2547struct workqueue_struct *__alloc_workqueue_key(const char *name,
2543 unsigned int flags, 2548 unsigned int flags,
2544 int max_active, 2549 int max_active,
2545 struct lock_class_key *key, 2550 struct lock_class_key *key,
2546 const char *lock_name) 2551 const char *lock_name)
2547{ 2552{
2548 struct workqueue_struct *wq; 2553 struct workqueue_struct *wq;
2549 unsigned int cpu; 2554 unsigned int cpu;
2550 2555
2556 max_active = max_active ?: WQ_DFL_ACTIVE;
2551 max_active = wq_clamp_max_active(max_active, name); 2557 max_active = wq_clamp_max_active(max_active, name);
2552 2558
2553 wq = kzalloc(sizeof(*wq), GFP_KERNEL); 2559 wq = kzalloc(sizeof(*wq), GFP_KERNEL);
@@ -2626,7 +2632,7 @@ err:
2626 } 2632 }
2627 return NULL; 2633 return NULL;
2628} 2634}
2629EXPORT_SYMBOL_GPL(__create_workqueue_key); 2635EXPORT_SYMBOL_GPL(__alloc_workqueue_key);
2630 2636
2631/** 2637/**
2632 * destroy_workqueue - safely terminate a workqueue 2638 * destroy_workqueue - safely terminate a workqueue
@@ -2910,7 +2916,7 @@ static int __cpuinit trustee_thread(void *__gcwq)
2910 continue; 2916 continue;
2911 2917
2912 debug_work_activate(rebind_work); 2918 debug_work_activate(rebind_work);
2913 insert_work(get_cwq(gcwq->cpu, keventd_wq), rebind_work, 2919 insert_work(get_cwq(gcwq->cpu, system_wq), rebind_work,
2914 worker->scheduled.next, 2920 worker->scheduled.next,
2915 work_color_to_flags(WORK_NO_COLOR)); 2921 work_color_to_flags(WORK_NO_COLOR));
2916 } 2922 }
@@ -3287,6 +3293,8 @@ void __init init_workqueues(void)
3287 spin_unlock_irq(&gcwq->lock); 3293 spin_unlock_irq(&gcwq->lock);
3288 } 3294 }
3289 3295
3290 keventd_wq = __create_workqueue("events", 0, WQ_DFL_ACTIVE); 3296 system_wq = alloc_workqueue("events", 0, 0);
3291 BUG_ON(!keventd_wq); 3297 system_long_wq = alloc_workqueue("events_long", 0, 0);
3298 system_nrt_wq = alloc_workqueue("events_nrt", WQ_NON_REENTRANT, 0);
3299 BUG_ON(!system_wq || !system_long_wq || !system_nrt_wq);
3292} 3300}