Commit f374048e authored by Bernardo Innocenti's avatar Bernardo Innocenti Committed by Jens Axboe

[PATCH] Make I/O schedulers optional

Add kconfig options to allow excluding either or both the I/O
schedulers.  This can be useful for embedded systems (saves about ~13KB).

All schedulers are enabled by default for non-embedded.
parent 48cb98d6
config IOSCHED_AS
bool "Anticipatory I/O scheduler" if EMBEDDED
default y
config IOSCHED_DEADLINE
bool "Deadline I/O scheduler" if EMBEDDED
default y
...@@ -13,9 +13,10 @@ ...@@ -13,9 +13,10 @@
# kblockd threads # kblockd threads
# #
obj-y := elevator.o ll_rw_blk.o ioctl.o genhd.o scsi_ioctl.o \ obj-y := elevator.o ll_rw_blk.o ioctl.o genhd.o scsi_ioctl.o
deadline-iosched.o as-iosched.o
obj-$(CONFIG_IOSCHED_AS) += as-iosched.o
obj-$(CONFIG_IOSCHED_DEADLINE) += deadline-iosched.o
obj-$(CONFIG_MAC_FLOPPY) += swim3.o obj-$(CONFIG_MAC_FLOPPY) += swim3.o
obj-$(CONFIG_BLK_DEV_FD) += floppy.o obj-$(CONFIG_BLK_DEV_FD) += floppy.o
obj-$(CONFIG_BLK_DEV_FD98) += floppy98.o obj-$(CONFIG_BLK_DEV_FD98) += floppy98.o
......
...@@ -1842,6 +1842,7 @@ elevator_t iosched_as = { ...@@ -1842,6 +1842,7 @@ elevator_t iosched_as = {
.elevator_exit_fn = as_exit, .elevator_exit_fn = as_exit,
.elevator_ktype = &as_ktype, .elevator_ktype = &as_ktype,
.elevator_name = "anticipatory scheduling",
}; };
EXPORT_SYMBOL(iosched_as); EXPORT_SYMBOL(iosched_as);
...@@ -940,6 +940,7 @@ elevator_t iosched_deadline = { ...@@ -940,6 +940,7 @@ elevator_t iosched_deadline = {
.elevator_exit_fn = deadline_exit, .elevator_exit_fn = deadline_exit,
.elevator_ktype = &deadline_ktype, .elevator_ktype = &deadline_ktype,
.elevator_name = "deadline",
}; };
EXPORT_SYMBOL(iosched_deadline); EXPORT_SYMBOL(iosched_deadline);
...@@ -420,6 +420,7 @@ elevator_t elevator_noop = { ...@@ -420,6 +420,7 @@ elevator_t elevator_noop = {
.elevator_merge_req_fn = elevator_noop_merge_requests, .elevator_merge_req_fn = elevator_noop_merge_requests,
.elevator_next_req_fn = elevator_noop_next_request, .elevator_next_req_fn = elevator_noop_next_request,
.elevator_add_req_fn = elevator_noop_add_request, .elevator_add_req_fn = elevator_noop_add_request,
.elevator_name = "noop",
}; };
module_init(elevator_global_init); module_init(elevator_global_init);
......
...@@ -1209,17 +1209,31 @@ static int blk_init_free_list(request_queue_t *q) ...@@ -1209,17 +1209,31 @@ static int blk_init_free_list(request_queue_t *q)
static int __make_request(request_queue_t *, struct bio *); 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) static int __init elevator_setup(char *str)
{ {
#ifdef CONFIG_IOSCHED_DEADLINE
if (!strcmp(str, "deadline")) if (!strcmp(str, "deadline"))
chosen_elevator = &iosched_deadline; chosen_elevator = &iosched_deadline;
#endif
#ifdef CONFIG_IOSCHED_AS
if (!strcmp(str, "as")) if (!strcmp(str, "as"))
chosen_elevator = &iosched_as; chosen_elevator = &iosched_as;
#endif
return 1; return 1;
} }
__setup("elevator=", elevator_setup); __setup("elevator=", elevator_setup);
#endif /* CONFIG_IOSCHED_AS || CONFIG_IOSCHED_DEADLINE */
/** /**
* blk_init_queue - prepare a request queue for use with a block device * blk_init_queue - prepare a request queue for use with a block device
...@@ -1259,10 +1273,7 @@ int blk_init_queue(request_queue_t *q, request_fn_proc *rfn, spinlock_t *lock) ...@@ -1259,10 +1273,7 @@ int blk_init_queue(request_queue_t *q, request_fn_proc *rfn, spinlock_t *lock)
if (!printed) { if (!printed) {
printed = 1; printed = 1;
if (chosen_elevator == &iosched_deadline) printk("Using %s elevator\n", chosen_elevator->elevator_name);
printk("deadline elevator\n");
else if (chosen_elevator == &iosched_as)
printk("anticipatory scheduling elevator\n");
} }
if ((ret = elevator_init(q, chosen_elevator))) { if ((ret = elevator_init(q, chosen_elevator))) {
......
...@@ -54,6 +54,7 @@ struct elevator_s ...@@ -54,6 +54,7 @@ struct elevator_s
struct kobject kobj; struct kobject kobj;
struct kobj_type *elevator_ktype; struct kobj_type *elevator_ktype;
const char *elevator_name;
}; };
/* /*
......
...@@ -141,6 +141,8 @@ config EPOLL ...@@ -141,6 +141,8 @@ config EPOLL
Disabling this option will cause the kernel to be built without Disabling this option will cause the kernel to be built without
support for epoll family of system calls. support for epoll family of system calls.
source "drivers/block/Kconfig.iosched"
endmenu # General setup endmenu # General setup
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment