diff options
| author | Russell King <rmk+kernel@arm.linux.org.uk> | 2015-07-07 14:35:33 +0300 |
|---|---|---|
| committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2015-07-07 14:35:33 +0300 |
| commit | 06be5eefe1192eb8ce8d07497f67595b6bfe9741 (patch) | |
| tree | 80f1987d4970f8079681f8be0c135cafc8d6329a /include/linux/workqueue.h | |
| parent | 11b8b25ce4f8acfd3b438683c0c9ade27756c6e8 (diff) | |
| parent | 1bd46782d08b01b73df0085b51ea1021b19b44fd (diff) | |
| download | linux-06be5eefe1192eb8ce8d07497f67595b6bfe9741.tar.xz | |
Merge branches 'fixes' and 'ioremap' into for-linus
Diffstat (limited to 'include/linux/workqueue.h')
| -rw-r--r-- | include/linux/workqueue.h | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index deee212af8e0..738b30b39b68 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -424,6 +424,7 @@ struct workqueue_attrs *alloc_workqueue_attrs(gfp_t gfp_mask); void free_workqueue_attrs(struct workqueue_attrs *attrs); int apply_workqueue_attrs(struct workqueue_struct *wq, const struct workqueue_attrs *attrs); +int workqueue_set_unbound_cpumask(cpumask_var_t cpumask); extern bool queue_work_on(int cpu, struct workqueue_struct *wq, struct work_struct *work); @@ -434,7 +435,6 @@ extern bool mod_delayed_work_on(int cpu, struct workqueue_struct *wq, extern void flush_workqueue(struct workqueue_struct *wq); extern void drain_workqueue(struct workqueue_struct *wq); -extern void flush_scheduled_work(void); extern int schedule_on_each_cpu(work_func_t func); @@ -531,6 +531,35 @@ static inline bool schedule_work(struct work_struct *work) } /** + * flush_scheduled_work - ensure that any scheduled work has run to completion. + * + * Forces execution of the kernel-global workqueue and blocks until its + * completion. + * + * Think twice before calling this function! It's very easy to get into + * trouble if you don't take great care. Either of the following situations + * will lead to deadlock: + * + * One of the work items currently on the workqueue needs to acquire + * a lock held by your code or its caller. + * + * Your code is running in the context of a work routine. + * + * They will be detected by lockdep when they occur, but the first might not + * occur very often. It depends on what work items are on the workqueue and + * what locks they need, which you have no control over. + * + * In most situations flushing the entire workqueue is overkill; you merely + * need to know that a particular work item isn't queued and isn't running. + * In such cases you should use cancel_delayed_work_sync() or + * cancel_work_sync() instead. + */ +static inline void flush_scheduled_work(void) +{ + flush_workqueue(system_wq); +} + +/** * schedule_delayed_work_on - queue work in global workqueue on CPU after delay * @cpu: cpu to use * @dwork: job to be done |
