linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Galbraith <efault@gmx.de>
To: Jens Axboe <jens.axboe@oracle.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Vivek Goyal <vgoyal@redhat.com>,
	Ulrich Lukas <stellplatz-nr.13a@datenparkplatz.de>,
	linux-kernel@vger.kernel.org,
	containers@lists.linux-foundation.org, dm-devel@redhat.com,
	nauman@google.com, dpshah@google.com, lizf@cn.fujitsu.com,
	mikew@google.com, fchecconi@gmail.com, paolo.valente@unimore.it,
	ryov@valinux.co.jp, fernando@oss.ntt.co.jp, jmoyer@redhat.com,
	dhaval@linux.vnet.ibm.com, balbir@linux.vnet.ibm.com,
	righi.andrea@gmail.com, m-ikeda@ds.jp.nec.com, agk@redhat.com,
	akpm@linux-foundation.org, peterz@infradead.org,
	jmarchan@redhat.com, riel@redhat.com
Subject: tweaking IO latency [was Re: IO scheduler based IO controller V10]
Date: Sat, 03 Oct 2009 08:31:06 +0200	[thread overview]
Message-ID: <1254551466.7716.4.camel@marge.simson.net> (raw)
In-Reply-To: <1254549378.8299.21.camel@marge.simson.net>

P.S.  now may be a good time to finally exit thread (and maybe trim cc?)

On Sat, 2009-10-03 at 07:56 +0200, Mike Galbraith wrote:
> On Sat, 2009-10-03 at 07:49 +0200, Mike Galbraith wrote:
> > On Fri, 2009-10-02 at 20:19 +0200, Jens Axboe wrote:
> > 
> > > If you could do a cleaned up version of your overload patch based on
> > > this:
> > > 
> > > http://git.kernel.dk/?p=linux-2.6-block.git;a=commit;h=1d2235152dc745c6d94bedb550fea84cffdbf768
> > > 
> > > then lets take it from there.
> 
> Note to self: build the darn thing after last minute changes.
> 
> Block:  Delay overloading of CFQ queues to improve read latency.
> 
> Introduce a delay maximum dispatch timestamp, and stamp it when:
>         1. we encounter a known seeky or possibly new sync IO queue.
>         2. the current queue may go idle and we're draining async IO.
>         3. we have sync IO in flight and are servicing an async queue.
>         4  we are not the sole user of disk.
> Disallow exceeding quantum if any of these events have occurred recently.
> 
> Protect this behavioral change with a "desktop_dispatch" knob and default
> it to "on".. providing an easy means of regression verification prior to
> hate-mail dispatch :) to CC list.
> 
> Signed-off-by: Mike Galbraith <efault@gmx.de>
> Cc: Jens Axboe <jens.axboe@oracle.com>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> ... others who let somewhat hacky tweak slip by
> 
> ---
>  block/cfq-iosched.c |   45 +++++++++++++++++++++++++++++++++++++++++----
>  1 file changed, 41 insertions(+), 4 deletions(-)
> 
> Index: linux-2.6/block/cfq-iosched.c
> ===================================================================
> --- linux-2.6.orig/block/cfq-iosched.c
> +++ linux-2.6/block/cfq-iosched.c
> @@ -174,6 +174,9 @@ struct cfq_data {
>  	unsigned int cfq_slice_async_rq;
>  	unsigned int cfq_slice_idle;
>  	unsigned int cfq_desktop;
> +	unsigned int cfq_desktop_dispatch;
> +
> +	unsigned long desktop_dispatch_ts;
>  
>  	struct list_head cic_list;
>  
> @@ -1283,6 +1286,7 @@ static int cfq_dispatch_requests(struct
>  	struct cfq_data *cfqd = q->elevator->elevator_data;
>  	struct cfq_queue *cfqq;
>  	unsigned int max_dispatch;
> +	unsigned long delay;
>  
>  	if (!cfqd->busy_queues)
>  		return 0;
> @@ -1297,19 +1301,26 @@ static int cfq_dispatch_requests(struct
>  	/*
>  	 * Drain async requests before we start sync IO
>  	 */
> -	if (cfq_cfqq_idle_window(cfqq) && cfqd->rq_in_driver[BLK_RW_ASYNC])
> +	if (cfq_cfqq_idle_window(cfqq) && cfqd->rq_in_driver[BLK_RW_ASYNC]) {
> +		cfqd->desktop_dispatch_ts = jiffies;
>  		return 0;
> +	}
>  
>  	/*
>  	 * If this is an async queue and we have sync IO in flight, let it wait
>  	 */
> -	if (cfqd->sync_flight && !cfq_cfqq_sync(cfqq))
> +	if (cfqd->sync_flight && !cfq_cfqq_sync(cfqq)) {
> +		cfqd->desktop_dispatch_ts = jiffies;
>  		return 0;
> +	}
>  
>  	max_dispatch = cfqd->cfq_quantum;
>  	if (cfq_class_idle(cfqq))
>  		max_dispatch = 1;
>  
> +	if (cfqd->busy_queues > 1)
> +		cfqd->desktop_dispatch_ts = jiffies;
> +
>  	/*
>  	 * Does this cfqq already have too much IO in flight?
>  	 */
> @@ -1327,6 +1338,16 @@ static int cfq_dispatch_requests(struct
>  			return 0;
>  
>  		/*
> +		 * Don't start overloading until we've been alone for a bit.
> +		 */
> +		if (cfqd->cfq_desktop_dispatch) {
> +			delay = cfqd->desktop_dispatch_ts + cfq_slice_sync;
> +
> +			if (time_before(jiffies, max_delay))
> +				return 0;
> +		}
> +
> +		/*
>  		 * we are the only queue, allow up to 4 times of 'quantum'
>  		 */
>  		if (cfqq->dispatched >= 4 * max_dispatch)
> @@ -1942,7 +1963,7 @@ static void
>  cfq_update_idle_window(struct cfq_data *cfqd, struct cfq_queue *cfqq,
>  		       struct cfq_io_context *cic)
>  {
> -	int old_idle, enable_idle;
> +	int old_idle, enable_idle, seeky = 0;
>  
>  	/*
>  	 * Don't idle for async or idle io prio class
> @@ -1950,10 +1971,20 @@ cfq_update_idle_window(struct cfq_data *
>  	if (!cfq_cfqq_sync(cfqq) || cfq_class_idle(cfqq))
>  		return;
>  
> +	if (cfqd->hw_tag) {
> +		if (CIC_SEEKY(cic))
> +			seeky = 1;
> +		/*
> +		 * If seeky or incalculable seekiness, delay overloading.
> +		 */
> +		if (seeky || !sample_valid(cic->seek_samples))
> +			cfqd->desktop_dispatch_ts = jiffies;
> +	}
> +
>  	enable_idle = old_idle = cfq_cfqq_idle_window(cfqq);
>  
>  	if (!atomic_read(&cic->ioc->nr_tasks) || !cfqd->cfq_slice_idle ||
> -	    (!cfqd->cfq_desktop && cfqd->hw_tag && CIC_SEEKY(cic)))
> +	    (!cfqd->cfq_desktop && seeky))
>  		enable_idle = 0;
>  	else if (sample_valid(cic->ttime_samples)) {
>  		if (cic->ttime_mean > cfqd->cfq_slice_idle)
> @@ -2483,6 +2514,9 @@ static void *cfq_init_queue(struct reque
>  	cfqd->cfq_slice_async_rq = cfq_slice_async_rq;
>  	cfqd->cfq_slice_idle = cfq_slice_idle;
>  	cfqd->cfq_desktop = 1;
> +	cfqd->cfq_desktop_dispatch = 1;
> +
> +	cfqd->desktop_dispatch_ts = INITIAL_JIFFIES;
>  	cfqd->hw_tag = 1;
>  
>  	return cfqd;
> @@ -2553,6 +2587,7 @@ SHOW_FUNCTION(cfq_slice_sync_show, cfqd-
>  SHOW_FUNCTION(cfq_slice_async_show, cfqd->cfq_slice[0], 1);
>  SHOW_FUNCTION(cfq_slice_async_rq_show, cfqd->cfq_slice_async_rq, 0);
>  SHOW_FUNCTION(cfq_desktop_show, cfqd->cfq_desktop, 0);
> +SHOW_FUNCTION(cfq_desktop_dispatch_show, cfqd->cfq_desktop_dispatch, 0);
>  #undef SHOW_FUNCTION
>  
>  #define STORE_FUNCTION(__FUNC, __PTR, MIN, MAX, __CONV)			\
> @@ -2585,6 +2620,7 @@ STORE_FUNCTION(cfq_slice_async_store, &c
>  STORE_FUNCTION(cfq_slice_async_rq_store, &cfqd->cfq_slice_async_rq, 1,
>  		UINT_MAX, 0);
>  STORE_FUNCTION(cfq_desktop_store, &cfqd->cfq_desktop, 0, 1, 0);
> +STORE_FUNCTION(cfq_desktop_dispatch_store, &cfqd->cfq_desktop_dispatch, 0, 1, 0);
>  #undef STORE_FUNCTION
>  
>  #define CFQ_ATTR(name) \
> @@ -2601,6 +2637,7 @@ static struct elv_fs_entry cfq_attrs[] =
>  	CFQ_ATTR(slice_async_rq),
>  	CFQ_ATTR(slice_idle),
>  	CFQ_ATTR(desktop),
> +	CFQ_ATTR(desktop_dispatch),
>  	__ATTR_NULL
>  };
>  
> 


  reply	other threads:[~2009-10-03  6:31 UTC|newest]

Thread overview: 177+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-24 19:25 IO scheduler based IO controller V10 Vivek Goyal
2009-09-24 19:25 ` [PATCH 01/28] io-controller: Documentation Vivek Goyal
2009-09-24 19:25 ` [PATCH 02/28] io-controller: Core of the elevator fair queuing Vivek Goyal
2009-09-24 19:25 ` [PATCH 03/28] io-controller: Keep a cache of recently expired queues Vivek Goyal
2009-09-24 19:25 ` [PATCH 04/28] io-controller: Common flat fair queuing code in elevaotor layer Vivek Goyal
2009-09-24 19:25 ` [PATCH 05/28] io-controller: Modify cfq to make use of flat elevator fair queuing Vivek Goyal
2009-09-24 19:25 ` [PATCH 06/28] io-controller: Core scheduler changes to support hierarhical scheduling Vivek Goyal
2009-09-24 19:25 ` [PATCH 07/28] io-controller: cgroup related changes for hierarchical group support Vivek Goyal
2009-09-24 19:25 ` [PATCH 08/28] io-controller: Common hierarchical fair queuing code in elevaotor layer Vivek Goyal
2009-09-24 19:25 ` [PATCH 09/28] io-controller: cfq changes to use " Vivek Goyal
2009-09-24 19:25 ` [PATCH 10/28] io-controller: Export disk time used and nr sectors dipatched through cgroups Vivek Goyal
2009-09-24 19:25 ` [PATCH 11/28] io-controller: Debug hierarchical IO scheduling Vivek Goyal
2009-09-24 19:25 ` [PATCH 12/28] io-controller: Introduce group idling Vivek Goyal
2009-09-24 19:25 ` [PATCH 13/28] io-controller: Implement wait busy for io queues Vivek Goyal
2009-09-24 19:25 ` [PATCH 14/28] io-controller: Keep track of late preemptions Vivek Goyal
2009-09-24 19:25 ` [PATCH 15/28] io-controller: Allow CFQ specific extra preemptions Vivek Goyal
2009-09-25  6:24   ` Gui Jianfeng
2009-09-24 19:25 ` [PATCH 16/28] io-controller: Wait for requests to complete from last queue before new queue is scheduled Vivek Goyal
2009-09-24 19:25 ` [PATCH 17/28] io-controller: Separate out queue and data Vivek Goyal
2009-09-24 19:25 ` [PATCH 18/28] io-conroller: Prepare elevator layer for single queue schedulers Vivek Goyal
2009-09-24 19:25 ` [PATCH 19/28] io-controller: Avoid expiring ioq for single ioq scheduler if only root group Vivek Goyal
2009-09-24 19:25 ` [PATCH 20/28] io-controller: noop changes for hierarchical fair queuing Vivek Goyal
2009-09-24 19:25 ` [PATCH 21/28] io-controller: deadline " Vivek Goyal
2009-09-24 19:25 ` [PATCH 22/28] io-controller: anticipatory " Vivek Goyal
2009-09-24 19:25 ` [PATCH 23/28] io-controller: blkio_cgroup patches from Ryo to track async bios Vivek Goyal
2009-09-24 19:25 ` [PATCH 24/28] io-controller: map async requests to appropriate cgroup Vivek Goyal
2009-09-24 19:25 ` [PATCH 25/28] io-controller: Per cgroup request descriptor support Vivek Goyal
2009-09-24 19:25 ` [PATCH 26/28] io-controller: Per io group bdi congestion interface Vivek Goyal
2009-09-24 19:25 ` [PATCH 27/28] io-controller: Support per cgroup per device weights and io class Vivek Goyal
2009-09-24 19:25 ` [PATCH 28/28] io-controller: debug elevator fair queuing support Vivek Goyal
2009-09-24 21:33 ` IO scheduler based IO controller V10 Andrew Morton
2009-09-25  1:09   ` KAMEZAWA Hiroyuki
2009-09-25  1:18     ` KAMEZAWA Hiroyuki
2009-09-25  5:29       ` Balbir Singh
2009-09-25  7:09         ` Ryo Tsuruta
2009-09-25  4:14     ` Vivek Goyal
2009-09-25  5:04   ` Vivek Goyal
2009-09-25  9:07     ` Ryo Tsuruta
2009-09-25 14:33       ` Vivek Goyal
2009-09-28  7:30         ` Ryo Tsuruta
2009-09-25 15:04       ` Rik van Riel
2009-09-28  7:38         ` Ryo Tsuruta
2009-10-08  4:42   ` More performance numbers (Was: Re: IO scheduler based IO controller V10) Vivek Goyal
2009-10-08  8:34     ` Andrea Righi
2009-10-10 19:53   ` Performance numbers with IO throttling patches " Vivek Goyal
2009-10-10 22:27     ` Andrea Righi
2009-10-11 12:32       ` Vivek Goyal
2009-10-12 21:11       ` Vivek Goyal
2009-10-17 15:18         ` Andrea Righi
2009-09-25  2:20 ` IO scheduler based IO controller V10 Ulrich Lukas
2009-09-25 20:26   ` Vivek Goyal
2009-09-26 14:51     ` Mike Galbraith
2009-09-27  6:55       ` Mike Galbraith
2009-09-27 16:42         ` Jens Axboe
2009-09-27 18:15           ` Mike Galbraith
2009-09-28  4:04             ` Mike Galbraith
2009-09-28  5:55               ` Mike Galbraith
2009-09-28 17:48               ` Vivek Goyal
2009-09-28 18:24                 ` Mike Galbraith
2009-09-30 19:58           ` Mike Galbraith
2009-09-30 20:05             ` Mike Galbraith
2009-09-30 20:24               ` Vivek Goyal
2009-10-01  7:33                 ` Mike Galbraith
2009-10-01 18:58                   ` Jens Axboe
2009-10-02  6:23                     ` Mike Galbraith
2009-10-02  8:04                       ` Jens Axboe
2009-10-02  8:53                         ` Mike Galbraith
2009-10-02  9:00                           ` Mike Galbraith
2009-10-02  9:55                           ` Jens Axboe
2009-10-02 12:22                             ` Mike Galbraith
2009-10-02  9:24                         ` Ingo Molnar
2009-10-02  9:28                           ` Jens Axboe
2009-10-02 14:24                             ` Linus Torvalds
2009-10-02 14:45                               ` Mike Galbraith
2009-10-02 14:57                                 ` Jens Axboe
2009-10-02 14:56                               ` Jens Axboe
2009-10-02 15:14                                 ` Linus Torvalds
2009-10-02 16:01                                   ` jim owens
2009-10-02 17:11                                   ` Jens Axboe
2009-10-02 17:20                                     ` Ingo Molnar
2009-10-02 17:25                                       ` Jens Axboe
2009-10-02 17:28                                         ` Ingo Molnar
2009-10-02 17:37                                           ` Jens Axboe
2009-10-02 17:56                                             ` Ingo Molnar
2009-10-02 18:04                                               ` Jens Axboe
2009-10-02 18:22                                                 ` Mike Galbraith
2009-10-02 18:26                                                   ` Jens Axboe
2009-10-02 18:33                                                     ` Mike Galbraith
2009-10-02 18:36                                                 ` Theodore Tso
2009-10-02 18:45                                                   ` Jens Axboe
2009-10-02 19:01                                                     ` Ingo Molnar
2009-10-02 19:09                                                       ` Jens Axboe
2009-10-02 18:13                                             ` Mike Galbraith
2009-10-02 18:19                                               ` Jens Axboe
2009-10-02 18:57                                                 ` Mike Galbraith
2009-10-02 20:47                                                   ` Mike Galbraith
2009-10-03  5:48                                                 ` Mike Galbraith
2009-10-03  5:56                                                   ` Mike Galbraith
2009-10-03  6:31                                                     ` Mike Galbraith [this message]
2009-10-03  7:24                                                     ` Jens Axboe
2009-10-03  9:00                                                       ` Mike Galbraith
2009-10-03  9:12                                                         ` Corrado Zoccolo
2009-10-03 13:18                                                           ` Jens Axboe
2009-10-03 13:17                                                         ` Jens Axboe
2009-10-03 11:29                                                     ` Vivek Goyal
2009-10-03 12:40                                                       ` Do not overload dispatch queue (Was: Re: IO scheduler based IO controller V10) Vivek Goyal
2009-10-03 13:21                                                         ` Jens Axboe
2009-10-03 13:56                                                           ` Vivek Goyal
2009-10-03 14:02                                                             ` Mike Galbraith
2009-10-03 14:28                                                               ` Jens Axboe
2009-10-03 14:33                                                                 ` Mike Galbraith
2009-10-03 14:51                                                                 ` Mike Galbraith
2009-10-03 15:14                                                                   ` Jens Axboe
2009-10-03 15:57                                                                     ` Mike Galbraith
2009-10-03 17:35                                                                       ` Jens Axboe
2009-10-03 17:45                                                                         ` Linus Torvalds
2009-10-03 17:51                                                                           ` Jens Axboe
2009-10-03 19:07                                                                         ` Mike Galbraith
2009-10-03 19:11                                                                           ` Mike Galbraith
2009-10-03 19:23                                                                           ` Jens Axboe
2009-10-03 19:49                                                                             ` Mike Galbraith
2009-10-04 10:50                                                                               ` Mike Galbraith
2009-10-04 11:33                                                                                 ` Mike Galbraith
2009-10-04 17:39                                                                                 ` Jens Axboe
2009-10-04 18:23                                                                                   ` Mike Galbraith
2009-10-04 18:38                                                                                     ` Jens Axboe
2009-10-04 19:47                                                                                       ` Mike Galbraith
2009-10-04 20:17                                                                                         ` Jens Axboe
2009-10-04 22:15                                                                                           ` Mike Galbraith
2009-10-03 13:57                                                         ` Mike Galbraith
2009-10-03  7:20                                                   ` IO scheduler based IO controller V10 Ingo Molnar
2009-10-03  7:25                                                     ` Jens Axboe
2009-10-03  8:53                                                       ` Mike Galbraith
2009-10-03  9:01                                                       ` Corrado Zoccolo
2009-10-02 16:33                                 ` Ray Lee
2009-10-02 17:13                                   ` Jens Axboe
2009-10-02 16:22                               ` Ingo Molnar
2009-10-02  9:36                           ` Mike Galbraith
2009-10-02 16:37                             ` Ingo Molnar
2009-10-02 18:08                   ` Jens Axboe
2009-10-02 18:29                     ` Mike Galbraith
2009-10-02 18:36                       ` Jens Axboe
2009-09-27 17:00     ` Corrado Zoccolo
2009-09-28 14:56       ` Vivek Goyal
2009-09-28 15:35         ` Corrado Zoccolo
2009-09-28 17:14           ` Vivek Goyal
2009-09-29  7:10             ` Corrado Zoccolo
2009-09-28 17:51           ` Mike Galbraith
2009-09-28 18:18             ` Vivek Goyal
2009-09-28 18:53               ` Mike Galbraith
2009-09-29  7:14                 ` Corrado Zoccolo
2009-09-29  5:55             ` Mike Galbraith
2009-09-29  0:37 ` Nauman Rafique
2009-09-29  3:22   ` Vivek Goyal
2009-09-29  9:56     ` Ryo Tsuruta
2009-09-29 10:49       ` Takuya Yoshikawa
2009-09-29 14:10       ` Vivek Goyal
2009-09-29 19:53         ` Nauman Rafique
2009-09-30  8:43         ` Ryo Tsuruta
2009-09-30 11:05           ` Vivek Goyal
2009-10-01  6:41             ` Ryo Tsuruta
2009-10-01 13:31               ` Vivek Goyal
2009-10-02  2:57                 ` Vivek Goyal
2009-10-02 20:27                   ` Munehiro Ikeda
2009-10-05 10:38                     ` Ryo Tsuruta
2009-10-05 12:31                       ` Vivek Goyal
2009-10-05 14:55                         ` Ryo Tsuruta
2009-10-05 17:10                           ` Vivek Goyal
2009-10-05 18:11                             ` Nauman Rafique
2009-10-06  7:17                               ` Ryo Tsuruta
2009-10-06 11:22                                 ` Vivek Goyal
2009-10-07 14:38                                   ` Ryo Tsuruta
2009-10-07 15:09                                     ` Vivek Goyal
2009-10-08  2:18                                       ` Ryo Tsuruta
2009-10-07 16:41                                     ` Rik van Riel
2009-10-08 10:22                                       ` Ryo Tsuruta
2009-09-30  3:11       ` Vivek Goyal

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=1254551466.7716.4.camel@marge.simson.net \
    --to=efault@gmx.de \
    --cc=agk@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=dhaval@linux.vnet.ibm.com \
    --cc=dm-devel@redhat.com \
    --cc=dpshah@google.com \
    --cc=fchecconi@gmail.com \
    --cc=fernando@oss.ntt.co.jp \
    --cc=jens.axboe@oracle.com \
    --cc=jmarchan@redhat.com \
    --cc=jmoyer@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=m-ikeda@ds.jp.nec.com \
    --cc=mikew@google.com \
    --cc=mingo@elte.hu \
    --cc=nauman@google.com \
    --cc=paolo.valente@unimore.it \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=righi.andrea@gmail.com \
    --cc=ryov@valinux.co.jp \
    --cc=stellplatz-nr.13a@datenparkplatz.de \
    --cc=torvalds@linux-foundation.org \
    --cc=vgoyal@redhat.com \
    /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).