Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Tejun Heo and committed by
Jens Axboe
32e380ae b855b04a

+3 -30
-4
block/Kconfig.iosched
··· 23 23 24 24 config IOSCHED_CFQ 25 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 26 default y 29 27 ---help--- 30 28 The CFQ I/O scheduler tries to distribute bandwidth equally ··· 31 33 and server systems. 32 34 33 35 This is the default I/O scheduler. 34 - 35 - Note: If BLK_CGROUP=m, then CFQ can be built only as module. 36 36 37 37 config CFQ_GROUP_IOSCHED 38 38 bool "CFQ Group Scheduling support"
-17
block/blk-cgroup.c
··· 50 50 .attach = blkiocg_attach, 51 51 .destroy = blkiocg_destroy, 52 52 .populate = blkiocg_populate, 53 - #ifdef CONFIG_BLK_CGROUP 54 - /* note: blkio_subsys_id is otherwise defined in blk-cgroup.h */ 55 53 .subsys_id = blkio_subsys_id, 56 - #endif 57 54 .use_id = 1, 58 55 .module = THIS_MODULE, 59 56 }; ··· 1676 1679 spin_unlock(&blkio_list_lock); 1677 1680 } 1678 1681 EXPORT_SYMBOL_GPL(blkio_policy_unregister); 1679 - 1680 - static int __init init_cgroup_blkio(void) 1681 - { 1682 - return cgroup_load_subsys(&blkio_subsys); 1683 - } 1684 - 1685 - static void __exit exit_cgroup_blkio(void) 1686 - { 1687 - cgroup_unload_subsys(&blkio_subsys); 1688 - } 1689 - 1690 - module_init(init_cgroup_blkio); 1691 - module_exit(exit_cgroup_blkio); 1692 - MODULE_LICENSE("GPL");
+2 -8
block/blk-cgroup.h
··· 24 24 /* Max limits for throttle policy */ 25 25 #define THROTL_IOPS_MAX UINT_MAX 26 26 27 - #if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE) 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 27 + #ifdef CONFIG_BLK_CGROUP 34 28 35 29 enum stat_type { 36 30 /* Total time spent (in ns) between request dispatch to the driver and ··· 297 303 static inline void blkiocg_set_start_empty_time(struct blkio_group *blkg) {} 298 304 #endif 299 305 300 - #if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE) 306 + #ifdef CONFIG_BLK_CGROUP 301 307 extern struct blkio_cgroup blkio_root_cgroup; 302 308 extern struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup); 303 309 extern struct blkio_cgroup *task_blkio_cgroup(struct task_struct *tsk);
+1 -1
init/Kconfig
··· 766 766 endif #CGROUP_SCHED 767 767 768 768 config BLK_CGROUP 769 - tristate "Block IO controller" 769 + bool "Block IO controller" 770 770 depends on BLOCK 771 771 default n 772 772 ---help---