Make I/O schedulers optional
PATCH 1/1 Make I/O schedulers optional
Hello Linus,
please apply this one. It has been reviewed and approved by both Jens Axboe and Andrew Morton.
--------------------------------------------------------------------------
Add kconfig options to allow excluding either or both the I/O schedulers. Mostly useful for embedded systems (save ~13KB):
With my desktop PC (i386) kernel:
text data bss dec hex filename 2210707 475856 150444 2837007 2b4a0f vmlinux_with_ioscheds 2197763 473446 150380 2821589 2b0dd5 vmlinux_without_ioscheds
With my uClinux (m68knommu) kernel:
text data bss dec hex filename 807760 47384 78884 934028 e408c linux_without_ioscheds 819276 52460 78896 950632 e8168 linux_with_ioscheds
drivers/block/Kconfig.iosched +8 -0
@@ -0,0 +1,8 @@ +config IOSCHED_AS + bool "Anticipatory I/O scheduler" if EMBEDDED + default y + +config IOSCHED_DEADLINE + bool "Deadline I/O scheduler" if EMBEDDED + default y +
drivers/block/Makefile +3 -2
@@ -13,9 +13,10 @@ # kblockd threads # -obj-y := elevator.o ll_rw_blk.o ioctl.o genhd.o scsi_ioctl.o \ - deadline-iosched.o as-iosched.o +obj-y := elevator.o ll_rw_blk.o ioctl.o genhd.o scsi_ioctl.o +obj-$(CONFIG_IOSCHED_AS) += as-iosched.o +obj-$(CONFIG_IOSCHED_DEADLINE) += deadline-iosched.o obj-$(CONFIG_MAC_FLOPPY) += swim3.o obj-$(CONFIG_BLK_DEV_FD) += floppy.o obj-$(CONFIG_BLK_DEV_FD98) += floppy98.o
drivers/block/as-iosched.c +1 -0
@@ -1832,6 +1832,7 @@ .elevator_exit_fn = as_exit, .elevator_ktype = &as_ktype, + .elevator_name = "anticipatory scheduling", };EXPORT_SYMBOL (iosched_as);
drivers/block/deadline-iosched.c +1 -0
@@ -941,6 +941,7 @@ .elevator_exit_fn = deadline_exit, .elevator_ktype = &deadline_ktype, + .elevator_name = "deadline", };EXPORT_SYMBOL (iosched_deadline);
drivers/block/elevator.c +1 -0
@@ -409,6 +409,7 @@ .elevator_merge_req_fn = elevator_noop_merge_requests, .elevator_next_req_fn = elevator_noop_next_request, .elevator_add_req_fn = elevator_noop_add_request, + .elevator_name = "noop", };module_init (elevator_global_init);
drivers/block/ll_rw_blk.c +16 -5
@@ -1205,17 +1205,31 @@static int __make_request (request_queue_t *,struct bio *); -static elevator_t *chosen_elevator = &iosched_as; +static elevator_t *chosen_elevator = +#if defined(CONFIG_IOSCHED_AS ) + &iosched_as; +#elif defined(CONFIG_IOSCHED_DEADLINE ) + &iosched_deadline; +#else + &elevator_noop; +#endif +#if defined(CONFIG_IOSCHED_AS ) || defined(CONFIG_IOSCHED_DEADLINE )static int __init elevator_setup (char *str) { +#ifdef CONFIG_IOSCHED_DEADLINE if (!strcmp (str,"deadline" )) chosen_elevator = &iosched_deadline; +#endif +#ifdef CONFIG_IOSCHED_AS if (!strcmp (str,"as" )) chosen_elevator = &iosched_as; +#endif return 1 ; } +__setup ("elevator=" , elevator_setup); +#endif /* CONFIG_IOSCHED_AS || CONFIG_IOSCHED_DEADLINE */ /** * blk_init_queue - prepare a request queue for use with a block device
@@ -1255,10 +1269,7 @@if (!printed) { printed =1 ; -if (chosen_elevator == &iosched_deadline) -printk ("deadline elevator\n" ); -else if (chosen_elevator == &iosched_as) -printk ("anticipatory scheduling elevator\n" ); +printk ("Using %s elevator\n" , chosen_elevator->elevator_name); }if ((ret =elevator_init (q, chosen_elevator))) {
init/Kconfig +2 -0
@@ -141,6 +141,8 @@ Disabling this option will cause the kernel to be built without support for epoll family of system calls. +source "drivers/block/Kconfig.iosched" + endmenu # General setup
include/linux/elevator.h +1 -0
@@ -52,6 +52,7 @@struct kobject kobj;struct kobj_type *elevator_ktype; +const char *elevator_name; };/*
Signature · 4 lines
// Bernardo Innocenti - Develer S.r.l., R&D dept. \X/ http://www.develer.com/ Please don't send Word attachments - http://www.gnu.org/philosophy/no-word-attachments.html
drivers/block/Kconfig.iosched line 7
Quoted 9 lines
drivers/block/Kconfig.iosched +7
-0+config IOSCHED_AS + bool "Anticipatory I/O scheduler" if EMBEDDED + default y + +config IOSCHED_DEADLINE + bool "Deadline I/O scheduler" if EMBEDDED + default y
Please provide the help entries too.
Signature · 1 line
Tomas Szepe <[email protected]>
Quoted 11 lines · Tomas Szepe
drivers/block/Kconfig.iosched line 7
Quoted 9 lines
drivers/block/Kconfig.iosched +7
-0+config IOSCHED_AS + bool "Anticipatory I/O scheduler" if EMBEDDED + default y + +config IOSCHED_DEADLINE + bool "Deadline I/O scheduler" if EMBEDDED + default yPlease provide the help entries too.
I wanted to, and I looked for something in the documentation to cut & paste instead of making up an inaccurate description myself.
Unfortunately, the documentation wrote by Jens got lost in -mm.
Signature · 4 lines
// Bernardo Innocenti - Develer S.r.l., R&D dept. \X/ http://www.develer.com/ Please don't send Word attachments - http://www.gnu.org/philosophy/no-word-attachments.html