linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bernardo Innocenti <bernie@develer.com>
To: Jens Axboe <axboe@suse.de>
Cc: Andrew Morton <akpm@osdl.org>,
	hch@infradead.org, willy@w.ods.org, hch@lst.de,
	uclinux-dev@uclinux.org, linux-kernel@vger.kernel.org,
	alan@lxorguk.ukuu.org.uk
Subject: Re: [PATCH] Make I/O schedulers optional (Was: Re: Kernel 2.6 size increase)
Date: Sun, 27 Jul 2003 01:42:47 +0200	[thread overview]
Message-ID: <200307270142.47602.bernie@develer.com> (raw)
In-Reply-To: <20030726140745.GB518@suse.de>

On Saturday 26 July 2003 16:07, Jens Axboe wrote:

> >  /*
> >   *  linux/drivers/block/as-iosched.c
> >   *
> > - *  Anticipatory & deadline i/o scheduler.
> > + *  Anticipatory i/o scheduler.
> >   *
> >   *  Copyright (C) 2002 Jens Axboe <axboe@suse.de>
> >   *                     Nick Piggin <piggin@cyberone.com.au>
>
> Huh? What is that about? AS is deadline + anticipation. Good rule is not
> to make comment changes when you don't know your changes to be a fact.

Oops, I thought it was done by mistake :-)

By the way, this comment in as-iosched.c refers to a missing file:

 /*
  * See Documentation/as-iosched.txt
  */

Another issue: to make the I/O schedulers configurable, I had to
fiddle with ll_rw_blk.c, makiing it slightly harder to understand.

The MTD layer uses a nice registration-based API that makes adding
maps and chips very clean and easy.

Of course, implementing a similar registration infrastructure just
to select between two scheduling policies would be overkill.

Instead, I think it would be nice if the kernel provided some
generic API for registration of components, modules, strategies,
algorithms, etc.

It could be useful in several places, from crypto to network protocols.

Perhaps it could be done with kobjs and it should provide a way to find
an item by name.

> About making it selectable, I'm fine with it. Please send an updated
> patch.

Here it is:

--------------------------------------------------------------------------

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


diff -Nru linux-2.6.0-test1.orig/drivers/block/Kconfig.iosched linux-2.6.0-test1-with_elevator_patch/drivers/block/Kconfig.iosched
--- linux-2.6.0-test1.orig/drivers/block/Kconfig.iosched	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.0-test1-with_elevator_patch/drivers/block/Kconfig.iosched	2003-07-26 14:25:44.000000000 +0200
@@ -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
+
diff -Nru linux-2.6.0-test1.orig/drivers/block/Makefile linux-2.6.0-test1-with_elevator_patch/drivers/block/Makefile
--- linux-2.6.0-test1.orig/drivers/block/Makefile	2003-07-14 05:37:16.000000000 +0200
+++ linux-2.6.0-test1-with_elevator_patch/drivers/block/Makefile	2003-07-25 20:21:50.000000000 +0200
@@ -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
diff -Nru linux-2.6.0-test1.orig/drivers/block/as-iosched.c linux-2.6.0-test1-with_elevator_patch/drivers/block/as-iosched.c
--- linux-2.6.0-test1.orig/drivers/block/as-iosched.c	2003-07-14 05:28:54.000000000 +0200
+++ linux-2.6.0-test1-with_elevator_patch/drivers/block/as-iosched.c	2003-07-25 20:19:44.000000000 +0200
@@ -1832,6 +1832,7 @@
 	.elevator_exit_fn =		as_exit,
 
 	.elevator_ktype =		&as_ktype,
+	.elevator_name =		"anticipatory scheduling",
 };
 
 EXPORT_SYMBOL(iosched_as);
diff -Nru linux-2.6.0-test1.orig/drivers/block/deadline-iosched.c linux-2.6.0-test1-with_elevator_patch/drivers/block/deadline-iosched.c
--- linux-2.6.0-test1.orig/drivers/block/deadline-iosched.c	2003-07-14 05:37:15.000000000 +0200
+++ linux-2.6.0-test1-with_elevator_patch/drivers/block/deadline-iosched.c	2003-07-25 20:20:53.000000000 +0200
@@ -941,6 +941,7 @@
 	.elevator_exit_fn =		deadline_exit,
 
 	.elevator_ktype =		&deadline_ktype,
+	.elevator_name =		"deadline",
 };
 
 EXPORT_SYMBOL(iosched_deadline);
diff -Nru linux-2.6.0-test1.orig/drivers/block/elevator.c linux-2.6.0-test1-with_elevator_patch/drivers/block/elevator.c
--- linux-2.6.0-test1.orig/drivers/block/elevator.c	2003-07-14 05:36:48.000000000 +0200
+++ linux-2.6.0-test1-with_elevator_patch/drivers/block/elevator.c	2003-07-25 19:27:41.000000000 +0200
@@ -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);
diff -Nru linux-2.6.0-test1.orig/drivers/block/ll_rw_blk.c linux-2.6.0-test1-with_elevator_patch/drivers/block/ll_rw_blk.c
--- linux-2.6.0-test1.orig/drivers/block/ll_rw_blk.c	2003-07-14 05:30:40.000000000 +0200
+++ linux-2.6.0-test1-with_elevator_patch/drivers/block/ll_rw_blk.c	2003-07-25 19:27:02.000000000 +0200
@@ -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))) {
diff -Nru linux-2.6.0-test1.orig/init/Kconfig linux-2.6.0-test1-with_elevator_patch/init/Kconfig
--- linux-2.6.0-test1.orig/init/Kconfig	2003-07-14 05:37:16.000000000 +0200
+++ linux-2.6.0-test1-with_elevator_patch/init/Kconfig	2003-07-26 14:25:48.000000000 +0200
@@ -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
 
 
diff -Nru linux-2.6.0-test1.orig/include/linux/elevator.h linux-2.6.0-test1/include/linux/elevator.h
--- linux-2.6.0-test1.orig/include/linux/elevator.h	2003-07-14 05:29:27.000000000 +0200
+++ linux-2.6.0-test1/include/linux/elevator.h	2003-07-25 19:18:39.000000000 +0200
@@ -52,6 +52,7 @@
 
 	struct kobject kobj;
 	struct kobj_type *elevator_ktype;
+	const char *elevator_name;
 };
 
 /*


-- 
  // 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



  reply	other threads:[~2003-07-26 23:28 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-23 18:46 Kernel 2.6 size increase Bernardo Innocenti
2003-07-23 19:14 ` Richard B. Johnson
2003-07-23 20:07   ` David S. Miller
2003-07-23 21:47     ` Randy.Dunlap
2003-07-23 19:32 ` [uClinux-dev] " Christoph Hellwig
2003-07-23 20:11   ` David S. Miller
2003-07-23 20:15     ` Christoph Hellwig
2003-07-23 20:22       ` David S. Miller
2003-07-23 20:27         ` Christoph Hellwig
2003-07-23 22:35           ` [uClinux-dev] Kernel 2.6 size increase - get_current()? Bernardo Innocenti
2003-07-23 22:37             ` Alan Cox
2003-07-23 23:00               ` Bernardo Innocenti
2003-07-24  5:06                 ` David McCullough
2003-07-24 11:28                   ` Alan Cox
2003-07-24 12:04                     ` David McCullough
2003-07-24 14:48                       ` Alan Cox
2003-07-25 18:25                       ` bill davidsen
2003-07-24 15:30                     ` Hollis Blanchard
2003-07-24 19:37                       ` Alan Cox
2003-07-24 19:51                         ` Hollis Blanchard
2003-07-24 21:20                           ` J.A. Magallon
2003-07-25  4:22                             ` Otto Solares
2003-07-25 14:38                               ` Hollis Blanchard
2003-07-28  3:19                                 ` Miles Bader
2003-07-28  8:14                                   ` Ihar "Philips" Filipau
2003-07-28  8:58                                     ` Miles Bader
2003-07-28  9:03                                       ` Ihar "Philips" Filipau
2003-07-23 21:57   ` [uClinux-dev] Kernel 2.6 size increase Bernardo Innocenti
2003-07-23 22:07     ` Bernardo Innocenti
2003-07-23 22:27       ` Willy Tarreau
2003-07-23 22:34         ` Alan Cox
2003-07-24 20:27         ` Bernardo Innocenti
2003-07-25 15:46           ` Christoph Hellwig
2003-07-25 23:55             ` [PATCH] Make I/O schedulers optional (Was: Re: Kernel 2.6 size increase) Bernardo Innocenti
2003-07-26  8:17               ` Andrew Morton
2003-07-26 12:40                 ` Bernardo Innocenti
2003-07-26 14:07                   ` Jens Axboe
2003-07-26 23:42                     ` Bernardo Innocenti [this message]
2003-07-26 23:41                       ` Jens Axboe
2003-07-28 17:13             ` [uClinux-dev] Kernel 2.6 size increase Nicolas Pitre
2003-07-28 23:02               ` Bernardo Innocenti
2003-07-29  2:36                 ` Miles Bader
2003-08-08 13:25                 ` [uClinux-dev] " David Woodhouse
2003-08-08 14:37                   ` Bernardo Innocenti
2003-08-08 14:43                     ` David Woodhouse
2003-07-25 18:16           ` bill davidsen
2003-07-29 22:29           ` Tom Rini
2003-07-29 22:48             ` Alan Cox
2003-07-29 23:06               ` Tom Rini
2003-07-30  2:07                 ` Miles Bader
2003-07-30 15:33                   ` Tom Rini
2003-07-31  1:49                     ` Miles Bader
2003-07-31  4:17                       ` Tom Rini
2003-07-31  5:03                         ` Miles Bader
2003-07-31 15:24                           ` Tom Rini
2003-07-30  2:49             ` [uClinux-dev] " Bernardo Innocenti
2003-07-30 15:35               ` Tom Rini
2003-07-30 16:45                 ` [uClinux-dev] Kernel 2.6 size increase (PATCH) Bernardo Innocenti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200307270142.47602.bernie@develer.com \
    --to=bernie@develer.com \
    --cc=akpm@osdl.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=axboe@suse.de \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=uclinux-dev@uclinux.org \
    --cc=willy@w.ods.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).