linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@redhat.com>
To: Corrado Zoccolo <czoccolo@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>, Ingo Molnar <mingo@elte.hu>,
	Mike Galbraith <efault@gmx.de>,
	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, torvalds@linux-foundation.org,
	riel@redhat.com
Subject: Re: IO scheduler based IO controller V10
Date: Fri, 2 Oct 2009 08:49:21 -0400	[thread overview]
Message-ID: <20091002124921.GA4494@redhat.com> (raw)
In-Reply-To: <200910021255.27689.czoccolo@gmail.com>

On Fri, Oct 02, 2009 at 12:55:25PM +0200, Corrado Zoccolo wrote:
> Hi Jens,
> On Fri, Oct 2, 2009 at 11:28 AM, Jens Axboe <jens.axboe@oracle.com> wrote:
> > On Fri, Oct 02 2009, Ingo Molnar wrote:
> >>
> >> * Jens Axboe <jens.axboe@oracle.com> wrote:
> >>
> >
> > It's really not that simple, if we go and do easy latency bits, then
> > throughput drops 30% or more. You can't say it's black and white latency
> > vs throughput issue, that's just not how the real world works. The
> > server folks would be most unpleased.
> Could we be more selective when the latency optimization is introduced?
> 
> The code that is currently touched by Vivek's patch is:
>         if (!atomic_read(&cic->ioc->nr_tasks) || !cfqd->cfq_slice_idle ||
>             (cfqd->hw_tag && CIC_SEEKY(cic)))
>                 enable_idle = 0;
> basically, when fairness=1, it becomes just:
>         if (!atomic_read(&cic->ioc->nr_tasks) || !cfqd->cfq_slice_idle)
>                 enable_idle = 0;
> 

Actually I am not touching this code. Looking at the V10, I have not
changed anything here in idling code.

I think we are seeing latency improvements with fairness=1 because, CFQ
does pure roundrobin and once a seeky reader expires, it is put at the
end of the queue.

I retained the same behavior if fairness=0 but if fairness=1, then I don't
put the seeky reader at the end of queue, instead it gets vdisktime based
on the disk it has used. So it should get placed ahead of sync readers.

I think following is the code snippet in "elevator-fq.c" which is making a
difference.

        /*
         * We don't want to charge more than allocated slice otherwise
         * this
         * queue can miss one dispatch round doubling max latencies. On
         * the
         * other hand we don't want to charge less than allocated slice as
         * we stick to CFQ theme of queue loosing its share if it does not
         * use the slice and moves to the back of service tree (almost).
         */
        if (!ioq->efqd->fairness)
                queue_charge = allocated_slice;
 
So if a sync readers consumes 100ms and an seeky reader dispatches only
one request, then in CFQ, seeky reader gets to dispatch next request after
another 100ms.

With fairness=1, it should get a lower vdisktime when it comes with a new
request because its last slice usage was less (like CFS sleepers as mike
said). But this will make a difference only if there are more than one
processes in the system otherwise a vtime jump will take place by the time
seeky readers gets backlogged.

Anyway, once I started timestamping the queues and started keeping a cache
of expired queues, then any queue which got new request almost
immediately, should get a lower vdisktime assigned if it did not use the
full time slice in the previous dispatch round. Hence  with fairness=1,
seeky readers kind of get more share of disk (fair share), because these
are now placed ahead of streaming readers and hence get better latencies.

In short, most likely, better latencies are being experienced because
seeky reader is getting lower time stamp (vdisktime), because it did not
use its full time slice in previous dispatch round, and not because we kept
the idling enabled on seeky reader.

Thanks
Vivek

> Note that, even if we enable idling here, the cfq_arm_slice_timer will use
> a different idle window for seeky (2ms) than for normal I/O.
> 
> I think that the 2ms idle window is good for a single rotational SATA disk scenario,
> even if it supports NCQ. Realistic access times for those disks are still around 8ms
> (but it is proportional to seek lenght), and waiting 2ms to see if we get a nearby
> request may pay off, not only in latency and fairness, but also in throughput.
> 
> What we don't want to do is to enable idling for NCQ enabled SSDs
> (and this is already taken care in cfq_arm_slice_timer) or for hardware RAIDs.
> If we agree that hardware RAIDs should be marked as non-rotational, then that
> code could become:
> 
>         if (!atomic_read(&cic->ioc->nr_tasks) || !cfqd->cfq_slice_idle ||
>             (blk_queue_nonrot(cfqd->queue) && cfqd->hw_tag && CIC_SEEKY(cic)))
>                 enable_idle = 0;
>         else if (sample_valid(cic->ttime_samples)) {
> 		unsigned idle_time = CIC_SEEKY(cic) ? CFQ_MIN_TT : cfqd->cfq_slice_idle;
> 		if (cic->ttime_mean > idle_time)
>                         enable_idle = 0;
>                 else
>                         enable_idle = 1;
>         }
> 
> Thanks,
> Corrado
> 
> >
> > --
> > Jens Axboe
> >
> 
> -- 
> __________________________________________________________________________
> 
> dott. Corrado Zoccolo                          mailto:czoccolo@gmail.com
> PhD - Department of Computer Science - University of Pisa, Italy
> --------------------------------------------------------------------------

  parent reply	other threads:[~2009-10-02 12:50 UTC|newest]

Thread overview: 140+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-02 10:55 IO scheduler based IO controller V10 Corrado Zoccolo
2009-10-02 11:04 ` Jens Axboe
2009-10-02 12:49 ` Vivek Goyal [this message]
2009-10-02 15:27   ` Corrado Zoccolo
2009-10-02 15:31     ` Vivek Goyal
2009-10-02 15:32     ` Mike Galbraith
2009-10-02 15:40       ` Vivek Goyal
2009-10-02 16:03         ` Mike Galbraith
2009-10-02 16:50         ` Valdis.Kletnieks
2009-10-02 19:58           ` Vivek Goyal
2009-10-02 22:14             ` Corrado Zoccolo
2009-10-02 22:27               ` Vivek Goyal
2009-10-03 12:43                 ` Corrado Zoccolo
2009-10-03 13:38                   ` Do we support ioprio on SSDs with NCQ (Was: Re: IO scheduler based IO controller V10) Vivek Goyal
2009-10-04  9:15                     ` Corrado Zoccolo
2009-10-04 12:11                       ` Vivek Goyal
2009-10-04 12:46                         ` Corrado Zoccolo
2009-10-04 16:20                           ` Fabio Checconi
2009-10-05 21:21                             ` Corrado Zoccolo
2009-10-05 15:06                           ` Jeff Moyer
2009-10-05 21:09                             ` Corrado Zoccolo
2009-10-06  8:41                               ` Jens Axboe
2009-10-06  9:00                                 ` Corrado Zoccolo
2009-10-06 18:53                                   ` Jens Axboe
2009-10-06 21:36                           ` Vivek Goyal
  -- strict thread matches above, loose matches on Subject: below --
2009-09-24 19:25 IO scheduler based IO controller V10 Vivek Goyal
2009-09-24 21:33 ` 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-09-25  2:20 ` 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  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  7:20                                                   ` 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=20091002124921.GA4494@redhat.com \
    --to=vgoyal@redhat.com \
    --cc=agk@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=czoccolo@gmail.com \
    --cc=dhaval@linux.vnet.ibm.com \
    --cc=dm-devel@redhat.com \
    --cc=dpshah@google.com \
    --cc=efault@gmx.de \
    --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 \
    /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).