diff options
author | Tejun Heo <tj@kernel.org> | 2012-03-05 16:14:54 -0500 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-03-06 15:27:21 -0500 |
commit | 32e380aedc3de454c06ce1c254fe3bea35a676e1 (patch) | |
tree | ae48ced36af22f020451cb05ecca835ff561dc9d | |
parent | b855b04a0b2213dbc1b59cf936056726e7ed97ad (diff) |
blkcg: make CONFIG_BLK_CGROUP bool
Block cgroup core can be built as module; however, it isn't too useful
as blk-throttle can only be built-in and cfq-iosched is usually the
default built-in scheduler. Scheduled blkcg cleanup requires calling
into blkcg from block core. To simplify that, disallow building blkcg
as module by making CONFIG_BLK_CGROUP bool.
If building blkcg core as module really matters, which I doubt, we can
revisit it after blkcg API cleanup.
-v2: Vivek pointed out that IOSCHED_CFQ was incorrectly updated to
depend on BLK_CGROUP. Fixed.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | block/Kconfig.iosched | 4 | ||||
-rw-r--r-- | block/blk-cgroup.c | 17 | ||||
-rw-r--r-- | block/blk-cgroup.h | 10 | ||||
-rw-r--r-- | init/Kconfig | 2 |
4 files changed, 3 insertions, 30 deletions
diff --git a/block/Kconfig.iosched b/block/Kconfig.iosched index 3199b76f795d..421bef9c4c48 100644 --- a/block/Kconfig.iosched +++ b/block/Kconfig.iosched | |||
@@ -23,8 +23,6 @@ config IOSCHED_DEADLINE | |||
23 | 23 | ||
24 | config IOSCHED_CFQ | 24 | config IOSCHED_CFQ |
25 | tristate "CFQ I/O scheduler" | 25 | tristate "CFQ I/O scheduler" |
26 | # If BLK_CGROUP is a module, CFQ has to be built as module. | ||
27 | depends on (BLK_CGROUP=m && m) || !BLK_CGROUP || BLK_CGROUP=y | ||
28 | default y | 26 | default y |
29 | ---help--- | 27 | ---help--- |
30 | The CFQ I/O scheduler tries to distribute bandwidth equally | 28 | The CFQ I/O scheduler tries to distribute bandwidth equally |
@@ -34,8 +32,6 @@ config IOSCHED_CFQ | |||
34 | 32 | ||
35 | This is the default I/O scheduler. | 33 | This is the default I/O scheduler. |
36 | 34 | ||
37 | Note: If BLK_CGROUP=m, then CFQ can be built only as module. | ||
38 | |||
39 | config CFQ_GROUP_IOSCHED | 35 | config CFQ_GROUP_IOSCHED |
40 | bool "CFQ Group Scheduling support" | 36 | bool "CFQ Group Scheduling support" |
41 | depends on IOSCHED_CFQ && BLK_CGROUP | 37 | depends on IOSCHED_CFQ && BLK_CGROUP |
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 75642a352a8f..970a717a056f 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -50,10 +50,7 @@ struct cgroup_subsys blkio_subsys = { | |||
50 | .attach = blkiocg_attach, | 50 | .attach = blkiocg_attach, |
51 | .destroy = blkiocg_destroy, | 51 | .destroy = blkiocg_destroy, |
52 | .populate = blkiocg_populate, | 52 | .populate = blkiocg_populate, |
53 | #ifdef CONFIG_BLK_CGROUP | ||
54 | /* note: blkio_subsys_id is otherwise defined in blk-cgroup.h */ | ||
55 | .subsys_id = blkio_subsys_id, | 53 | .subsys_id = blkio_subsys_id, |
56 | #endif | ||
57 | .use_id = 1, | 54 | .use_id = 1, |
58 | .module = THIS_MODULE, | 55 | .module = THIS_MODULE, |
59 | }; | 56 | }; |
@@ -1679,17 +1676,3 @@ void blkio_policy_unregister(struct blkio_policy_type *blkiop) | |||
1679 | spin_unlock(&blkio_list_lock); | 1676 | spin_unlock(&blkio_list_lock); |
1680 | } | 1677 | } |
1681 | EXPORT_SYMBOL_GPL(blkio_policy_unregister); | 1678 | EXPORT_SYMBOL_GPL(blkio_policy_unregister); |
1682 | |||
1683 | static int __init init_cgroup_blkio(void) | ||
1684 | { | ||
1685 | return cgroup_load_subsys(&blkio_subsys); | ||
1686 | } | ||
1687 | |||
1688 | static void __exit exit_cgroup_blkio(void) | ||
1689 | { | ||
1690 | cgroup_unload_subsys(&blkio_subsys); | ||
1691 | } | ||
1692 | |||
1693 | module_init(init_cgroup_blkio); | ||
1694 | module_exit(exit_cgroup_blkio); | ||
1695 | MODULE_LICENSE("GPL"); | ||
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index 6f3ace7e792f..355168772f51 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h | |||
@@ -24,13 +24,7 @@ enum blkio_policy_id { | |||
24 | /* Max limits for throttle policy */ | 24 | /* Max limits for throttle policy */ |
25 | #define THROTL_IOPS_MAX UINT_MAX | 25 | #define THROTL_IOPS_MAX UINT_MAX |
26 | 26 | ||
27 | #if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE) | 27 | #ifdef CONFIG_BLK_CGROUP |
28 | |||
29 | #ifndef CONFIG_BLK_CGROUP | ||
30 | /* When blk-cgroup is a module, its subsys_id isn't a compile-time constant */ | ||
31 | extern struct cgroup_subsys blkio_subsys; | ||
32 | #define blkio_subsys_id blkio_subsys.subsys_id | ||
33 | #endif | ||
34 | 28 | ||
35 | enum stat_type { | 29 | enum stat_type { |
36 | /* Total time spent (in ns) between request dispatch to the driver and | 30 | /* Total time spent (in ns) between request dispatch to the driver and |
@@ -303,7 +297,7 @@ static inline void blkiocg_update_idle_time_stats(struct blkio_group *blkg) {} | |||
303 | static inline void blkiocg_set_start_empty_time(struct blkio_group *blkg) {} | 297 | static inline void blkiocg_set_start_empty_time(struct blkio_group *blkg) {} |
304 | #endif | 298 | #endif |
305 | 299 | ||
306 | #if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE) | 300 | #ifdef CONFIG_BLK_CGROUP |
307 | extern struct blkio_cgroup blkio_root_cgroup; | 301 | extern struct blkio_cgroup blkio_root_cgroup; |
308 | extern struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup); | 302 | extern struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup); |
309 | extern struct blkio_cgroup *task_blkio_cgroup(struct task_struct *tsk); | 303 | extern struct blkio_cgroup *task_blkio_cgroup(struct task_struct *tsk); |
diff --git a/init/Kconfig b/init/Kconfig index 3f42cd66f0f8..da9222d5ae97 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -766,7 +766,7 @@ config RT_GROUP_SCHED | |||
766 | endif #CGROUP_SCHED | 766 | endif #CGROUP_SCHED |
767 | 767 | ||
768 | config BLK_CGROUP | 768 | config BLK_CGROUP |
769 | tristate "Block IO controller" | 769 | bool "Block IO controller" |
770 | depends on BLOCK | 770 | depends on BLOCK |
771 | default n | 771 | default n |
772 | ---help--- | 772 | ---help--- |