diff options
author | Tejun Heo <tj@kernel.org> | 2010-06-29 04:07:14 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2010-06-29 04:07:14 -0400 |
commit | dcd989cb73ab0f7b722d64ab6516f101d9f43f88 (patch) | |
tree | 8c2f14e708367cb67dd9d29f2da0f7e5f454cf31 /include/linux | |
parent | d320c03830b17af64e4547075003b1eeb274bc6c (diff) |
workqueue: implement several utility APIs
Implement the following utility APIs.
workqueue_set_max_active() : adjust max_active of a wq
workqueue_congested() : test whether a wq is contested
work_cpu() : determine the last / current cpu of a work
work_busy() : query whether a work is busy
* Anton Blanchard fixed missing ret initialization in work_busy().
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Anton Blanchard <anton@samba.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/workqueue.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 48b7422f25ae..0a7f79729380 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
@@ -61,6 +61,10 @@ enum { | |||
61 | WORK_STRUCT_FLAG_MASK = (1UL << WORK_STRUCT_FLAG_BITS) - 1, | 61 | WORK_STRUCT_FLAG_MASK = (1UL << WORK_STRUCT_FLAG_BITS) - 1, |
62 | WORK_STRUCT_WQ_DATA_MASK = ~WORK_STRUCT_FLAG_MASK, | 62 | WORK_STRUCT_WQ_DATA_MASK = ~WORK_STRUCT_FLAG_MASK, |
63 | WORK_STRUCT_NO_CPU = NR_CPUS << WORK_STRUCT_FLAG_BITS, | 63 | WORK_STRUCT_NO_CPU = NR_CPUS << WORK_STRUCT_FLAG_BITS, |
64 | |||
65 | /* bit mask for work_busy() return values */ | ||
66 | WORK_BUSY_PENDING = 1 << 0, | ||
67 | WORK_BUSY_RUNNING = 1 << 1, | ||
64 | }; | 68 | }; |
65 | 69 | ||
66 | struct work_struct { | 70 | struct work_struct { |
@@ -307,9 +311,14 @@ extern void init_workqueues(void); | |||
307 | int execute_in_process_context(work_func_t fn, struct execute_work *); | 311 | int execute_in_process_context(work_func_t fn, struct execute_work *); |
308 | 312 | ||
309 | extern int flush_work(struct work_struct *work); | 313 | extern int flush_work(struct work_struct *work); |
310 | |||
311 | extern int cancel_work_sync(struct work_struct *work); | 314 | extern int cancel_work_sync(struct work_struct *work); |
312 | 315 | ||
316 | extern void workqueue_set_max_active(struct workqueue_struct *wq, | ||
317 | int max_active); | ||
318 | extern bool workqueue_congested(unsigned int cpu, struct workqueue_struct *wq); | ||
319 | extern unsigned int work_cpu(struct work_struct *work); | ||
320 | extern unsigned int work_busy(struct work_struct *work); | ||
321 | |||
313 | /* | 322 | /* |
314 | * Kill off a pending schedule_delayed_work(). Note that the work callback | 323 | * Kill off a pending schedule_delayed_work(). Note that the work callback |
315 | * function may still be running on return from cancel_delayed_work(), unless | 324 | * function may still be running on return from cancel_delayed_work(), unless |