diff options
author | Tejun Heo <tj@kernel.org> | 2010-06-29 04:07:12 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2010-06-29 04:07:12 -0400 |
commit | 1e19ffc63dbbaea7a7d1c63d99c38d3e5a4c7edf (patch) | |
tree | 357690d6017682a4a21824f7d3f34a83406a136d /include | |
parent | affee4b294a0fc97d67c8a77dc080c4dd262a79e (diff) |
workqueue: implement per-cwq active work limit
Add cwq->nr_active, cwq->max_active and cwq->delayed_work. nr_active
counts the number of active works per cwq. A work is active if it's
flushable (colored) and is on cwq's worklist. If nr_active reaches
max_active, new works are queued on cwq->delayed_work and activated
later as works on the cwq complete and decrement nr_active.
cwq->max_active can be specified via the new @max_active parameter to
__create_workqueue() and is set to 1 for all workqueues for now. As
each cwq has only single worker now, this double queueing doesn't
cause any behavior difference visible to its users.
This will be used to reimplement freeze/thaw and implement shared
worker pool.
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/workqueue.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 4f4fdba722c3..eb753b7790e5 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
@@ -225,11 +225,11 @@ enum { | |||
225 | }; | 225 | }; |
226 | 226 | ||
227 | extern struct workqueue_struct * | 227 | extern struct workqueue_struct * |
228 | __create_workqueue_key(const char *name, unsigned int flags, | 228 | __create_workqueue_key(const char *name, unsigned int flags, int max_active, |
229 | struct lock_class_key *key, const char *lock_name); | 229 | struct lock_class_key *key, const char *lock_name); |
230 | 230 | ||
231 | #ifdef CONFIG_LOCKDEP | 231 | #ifdef CONFIG_LOCKDEP |
232 | #define __create_workqueue(name, flags) \ | 232 | #define __create_workqueue(name, flags, max_active) \ |
233 | ({ \ | 233 | ({ \ |
234 | static struct lock_class_key __key; \ | 234 | static struct lock_class_key __key; \ |
235 | const char *__lock_name; \ | 235 | const char *__lock_name; \ |
@@ -239,20 +239,20 @@ __create_workqueue_key(const char *name, unsigned int flags, | |||
239 | else \ | 239 | else \ |
240 | __lock_name = #name; \ | 240 | __lock_name = #name; \ |
241 | \ | 241 | \ |
242 | __create_workqueue_key((name), (flags), &__key, \ | 242 | __create_workqueue_key((name), (flags), (max_active), \ |
243 | __lock_name); \ | 243 | &__key, __lock_name); \ |
244 | }) | 244 | }) |
245 | #else | 245 | #else |
246 | #define __create_workqueue(name, flags) \ | 246 | #define __create_workqueue(name, flags, max_active) \ |
247 | __create_workqueue_key((name), (flags), NULL, NULL) | 247 | __create_workqueue_key((name), (flags), (max_active), NULL, NULL) |
248 | #endif | 248 | #endif |
249 | 249 | ||
250 | #define create_workqueue(name) \ | 250 | #define create_workqueue(name) \ |
251 | __create_workqueue((name), 0) | 251 | __create_workqueue((name), 0, 1) |
252 | #define create_freezeable_workqueue(name) \ | 252 | #define create_freezeable_workqueue(name) \ |
253 | __create_workqueue((name), WQ_FREEZEABLE | WQ_SINGLE_THREAD) | 253 | __create_workqueue((name), WQ_FREEZEABLE | WQ_SINGLE_THREAD, 1) |
254 | #define create_singlethread_workqueue(name) \ | 254 | #define create_singlethread_workqueue(name) \ |
255 | __create_workqueue((name), WQ_SINGLE_THREAD) | 255 | __create_workqueue((name), WQ_SINGLE_THREAD, 1) |
256 | 256 | ||
257 | extern void destroy_workqueue(struct workqueue_struct *wq); | 257 | extern void destroy_workqueue(struct workqueue_struct *wq); |
258 | 258 | ||