diff options
author | Tejun Heo <tj@kernel.org> | 2013-03-12 14:30:05 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-03-12 14:37:07 -0400 |
commit | 226223ab3c4118ddd10688cc2c131135848371ab (patch) | |
tree | 050da70ca30d34cbc9e21f628935e020c4106894 /include/linux/workqueue.h | |
parent | 36b519dfc7b57b8f91940a6e346d9a248e501e0d (diff) |
workqueue: implement sysfs interface for workqueues
There are cases where workqueue users want to expose control knobs to
userland. e.g. Unbound workqueues with custom attributes are
scheduled to be used for writeback workers and depending on
configuration it can be useful to allow admins to tinker with the
priority or allowed CPUs.
This patch implements workqueue_sysfs_register(), which makes the
workqueue visible under /sys/bus/workqueue/devices/WQ_NAME. There
currently are two attributes common to both per-cpu and unbound pools
and extra attributes for unbound pools including nice level and
cpumask.
If alloc_workqueue*() is called with WQ_SYSFS,
workqueue_sysfs_register() is called automatically as part of
workqueue creation. This is the preferred method unless the workqueue
user wants to apply workqueue_attrs before making the workqueue
visible to userland.
v2: Disallow exposing ordered workqueues as ordered workqueues can't
be tuned in any way.
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include/linux/workqueue.h')
-rw-r--r-- | include/linux/workqueue.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 5668ab249af5..7f6d29a417c0 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
@@ -293,6 +293,7 @@ enum { | |||
293 | WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */ | 293 | WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */ |
294 | WQ_HIGHPRI = 1 << 4, /* high priority */ | 294 | WQ_HIGHPRI = 1 << 4, /* high priority */ |
295 | WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */ | 295 | WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */ |
296 | WQ_SYSFS = 1 << 6, /* visible in sysfs, see wq_sysfs_register() */ | ||
296 | 297 | ||
297 | __WQ_DRAINING = 1 << 16, /* internal: workqueue is draining */ | 298 | __WQ_DRAINING = 1 << 16, /* internal: workqueue is draining */ |
298 | __WQ_ORDERED = 1 << 17, /* internal: workqueue is ordered */ | 299 | __WQ_ORDERED = 1 << 17, /* internal: workqueue is ordered */ |
@@ -495,4 +496,11 @@ extern bool freeze_workqueues_busy(void); | |||
495 | extern void thaw_workqueues(void); | 496 | extern void thaw_workqueues(void); |
496 | #endif /* CONFIG_FREEZER */ | 497 | #endif /* CONFIG_FREEZER */ |
497 | 498 | ||
499 | #ifdef CONFIG_SYSFS | ||
500 | int workqueue_sysfs_register(struct workqueue_struct *wq); | ||
501 | #else /* CONFIG_SYSFS */ | ||
502 | static inline int workqueue_sysfs_register(struct workqueue_struct *wq) | ||
503 | { return 0; } | ||
504 | #endif /* CONFIG_SYSFS */ | ||
505 | |||
498 | #endif | 506 | #endif |