linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Piggin <piggin@cyberone.com.au>
To: Chris Mason <mason@suse.com>
Cc: Andrea Arcangeli <andrea@suse.de>,
	Marc-Christian Petersen <m.c.p@wolk-project.de>,
	Jens Axboe <axboe@suse.de>,
	Marcelo Tosatti <marcelo@conectiva.com.br>,
	Georg Nikodym <georgn@somanetworks.com>,
	lkml <linux-kernel@vger.kernel.org>,
	Matthias Mueller <matthias.mueller@rz.uni-karlsruhe.de>
Subject: Re: [PATCH] io stalls
Date: Thu, 26 Jun 2003 23:04:49 +1000	[thread overview]
Message-ID: <3EFAEF71.1080109@cyberone.com.au> (raw)
In-Reply-To: <1056628116.20899.28.camel@tiny.suse.com>



Chris Mason wrote:

>On Thu, 2003-06-26 at 01:48, Nick Piggin wrote:
>
>
>>I am hoping to go a slightly different way in 2.5 pending
>>inclusion of process io contexts. If you had time to look
>>over my changes there (in current mm tree) it would be
>>appreciated, but they don't help your problem for 2.4.
>>
>>I found that my queue full fairness for 2.4 didn't address
>>the batching issue well. It does, guarantee lowest possible
>>maximum latency for singular requests, but due to lowered
>>throughput this can cause worse "high level" latency.
>>
>>I couldn't find a really good, comprehensive method of
>>allowing processes to batch without resorting to very
>>complex wakeup methods unless process io contexts are used.
>>The other possibility would be to keep a list of "batching"
>>processes which should achieve the same as io contexts.
>>
>>An easier approach would be to just allow the last woken
>>process to submit a batch of requests. This wouldn't have
>>as good guaranteed fairness, but not to say that it would
>>have starvation issues. I'll help you implement it if you
>>are interested.
>>
>
>One of the things I tried in this area was basically queue ownership. 
>When each process woke up, he was given strict ownership of the queue
>and could submit up to N number of requests.  One process waited for
>ownership in a yield loop for a max limit of a certain number of
>jiffies, all the others waited on the request queue.
>

Not sure exactly what you mean by one process waiting for ownership
in a yield loop, but why don't you simply allow the queue "owner" to
submit up to a maximum of N requests within a time limit. Once either
limit expires (or, rarely, another might become owner -) the process
would just be put to sleep by the normal queue_full mechanism.

>
>It generally increased the latency in __get_request wait by a multiple
>of N.  I didn't keep it because the current patch is already full of
>subtle interactions, I didn't want to make things more confusing than
>they already were ;-)
>

Yeah, something like that. I think that in a queue full situation,
the processes are wanting to submit more than 1 request though. So
the better thoughput you can achieve by batching translates to
better effective throughput. Read my recent debate with Andrea
about this though - I couldn't convince him!

I have seen much better maximum latencies, 2-3 times the
throughput, and an order of magnitude less context switching on
many threaded tiobench write loads when using batching.

In short, measuring get_request latency won't give you the full
story.

>
>The real problem with this approach is that we're guessing about the
>number of requests a given process wants to submit, and we're assuming
>those requests are going to be highly mergable.  If the higher levels
>pass these hints down to the elevator, we should be able to do a better
>job of giving both low latency and high throughput.
>

No, the numbers (batch # requests, batch time) are not highly scientific.
Simply when a process wakes up, we'll let them submit a small burst of
requests before they go back to sleep. Now in 2.5 (mm) we can cheat and
make this more effective, fair, and without possible missed wakes because
io contexts means that multiple processes can be batching at the same
time, and dynamically allocated requests means it doesn't matter if we
go a bit over the queue limit.

I think a decent solution for 2.4 would be to simply have the one queue
owner, but he allowed the queue to fall below the batch limit, wake
someone else and make them the owner. It can be a bit less fair, and
it doesn't work across queues, but they're less important cases.

>
>Between bios and the pdflush daemons, I think 2.5 is in pretty good
>shape to do what we need.  I'm not 100% sure we need batching when the
>requests being submitted are not highly mergable, but I haven't put lots
>of thought into that part yet.
>

No, there are a couple of problems here.
First, good locality != sequential. I saw tiobench 256 random write
throughput _doubled_ because each process is writing within its own
file.

Second, mergeable doesn't mean anything if your request size only
grows to say 128KB (IDE). I saw tiobench 256 sequential writes on IDE
go from ~ 25% peak throughput to ~70% (4.85->14.11 from 20MB/s disk)

Third, context switch rate. In the latest IBM regression tests,
tiobench 64 on ext2, 8xSMP (so don't look at throughput!), average
cs/s was about 2500 with mainline (FIFO request allocation), and
140 in mm (batching allocation). So nearly 20x better. This might
not be due to batching alone, but I didn't see any other obvious
change in mm.

>
>Anyway for 2.4 I'm not sure there's much more we can do.  I'd like to
>add tunables to the current patch, so userland can control the max io in
>flight and a simple toggle between throughput mode and latency mode on a
>per device basis.  It's not perfect but should tide us over until 2.6.
>
>

The changes do seem to be a critical fix due to the starvation issue,
but I'm worried that they take a big step back in performance under
high disk load. I found my FIFO mechanism to be unacceptably slow for
2.5.




  reply	other threads:[~2003-06-26 12:51 UTC|newest]

Thread overview: 109+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-29  0:55 Linux 2.4.21-rc6 Marcelo Tosatti
2003-05-29  1:22 ` Con Kolivas
2003-05-29  5:24   ` Marc Wilson
2003-05-29  5:34     ` Riley Williams
2003-05-29  5:57       ` Marc Wilson
2003-05-29  7:15         ` Riley Williams
2003-05-29  8:38         ` Willy Tarreau
2003-05-29  8:40           ` Willy Tarreau
2003-06-03 16:02         ` Marcelo Tosatti
2003-06-03 16:13           ` Marc-Christian Petersen
2003-06-04 21:54             ` Pavel Machek
2003-06-05  2:10               ` Michael Frank
2003-06-03 16:30           ` Michael Frank
2003-06-03 16:53             ` Matthias Mueller
2003-06-03 16:59             ` Marc-Christian Petersen
2003-06-03 17:03               ` Marc-Christian Petersen
2003-06-03 18:02                 ` Anders Karlsson
2003-06-03 21:12                   ` J.A. Magallon
2003-06-03 21:18                     ` Marc-Christian Petersen
2003-06-03 17:23               ` Michael Frank
2003-06-04 14:56             ` Jakob Oestergaard
2003-06-04  4:04           ` Marc Wilson
2003-05-29 10:02 ` Con Kolivas
2003-05-29 18:00 ` Georg Nikodym
2003-05-29 19:11   ` -rc7 " Marcelo Tosatti
2003-05-29 19:56     ` Krzysiek Taraszka
2003-05-29 20:18       ` Krzysiek Taraszka
2003-06-04 18:17         ` Marcelo Tosatti
2003-06-04 21:41           ` Krzysiek Taraszka
2003-06-04 22:37             ` Alan Cox
2003-06-04 10:22     ` Andrea Arcangeli
2003-06-04 10:35       ` Marc-Christian Petersen
2003-06-04 10:42         ` Jens Axboe
2003-06-04 10:46           ` Marc-Christian Petersen
2003-06-04 10:48             ` Andrea Arcangeli
2003-06-04 11:57               ` Nick Piggin
2003-06-04 12:00                 ` Jens Axboe
2003-06-04 12:09                   ` Andrea Arcangeli
2003-06-04 12:20                     ` Jens Axboe
2003-06-04 20:50                       ` Rob Landley
2003-06-04 12:11                   ` Nick Piggin
2003-06-04 12:35                 ` Miquel van Smoorenburg
2003-06-09 21:39                 ` [PATCH] io stalls (was: -rc7 Re: Linux 2.4.21-rc6) Chris Mason
2003-06-09 22:19                   ` Andrea Arcangeli
2003-06-10  0:27                     ` Chris Mason
2003-06-10 23:13                     ` Chris Mason
2003-06-11  0:16                       ` Andrea Arcangeli
2003-06-11  0:44                         ` Chris Mason
2003-06-09 23:51                   ` [PATCH] io stalls Nick Piggin
2003-06-10  0:32                     ` Chris Mason
2003-06-10  0:47                       ` Nick Piggin
2003-06-10  1:48                     ` Robert White
2003-06-10  2:13                       ` Chris Mason
2003-06-10 23:04                         ` Robert White
2003-06-11  0:58                           ` Chris Mason
2003-06-10  3:22                       ` Nick Piggin
2003-06-10 21:17                         ` Robert White
2003-06-11  0:40                           ` Nick Piggin
2003-06-11  0:33                   ` [PATCH] io stalls (was: -rc7 Re: Linux 2.4.21-rc6) Andrea Arcangeli
2003-06-11  0:48                     ` [PATCH] io stalls Nick Piggin
2003-06-11  1:07                       ` Andrea Arcangeli
2003-06-11  0:54                     ` [PATCH] io stalls (was: -rc7 Re: Linux 2.4.21-rc6) Chris Mason
2003-06-11  1:06                       ` Andrea Arcangeli
2003-06-11  1:57                         ` Chris Mason
2003-06-11  2:10                           ` Andrea Arcangeli
2003-06-11 12:24                             ` Chris Mason
2003-06-11 17:42                             ` Chris Mason
2003-06-11 18:12                               ` Andrea Arcangeli
2003-06-11 18:27                                 ` Chris Mason
2003-06-11 18:35                                   ` Andrea Arcangeli
2003-06-12  1:04                                     ` [PATCH] io stalls Nick Piggin
2003-06-12  1:12                                       ` Chris Mason
2003-06-12  1:29                                       ` Andrea Arcangeli
2003-06-12  1:37                                         ` Andrea Arcangeli
2003-06-12  2:22                                         ` Chris Mason
2003-06-12  2:41                                           ` Nick Piggin
2003-06-12  2:46                                             ` Andrea Arcangeli
2003-06-12  2:49                                               ` Nick Piggin
2003-06-12  2:51                                                 ` Nick Piggin
2003-06-12  2:52                                                   ` Nick Piggin
2003-06-12  3:04                                                   ` Andrea Arcangeli
2003-06-12  2:58                                                 ` Andrea Arcangeli
2003-06-12  3:04                                                   ` Nick Piggin
2003-06-12  3:12                                                     ` Andrea Arcangeli
2003-06-12  3:20                                                       ` Nick Piggin
2003-06-12  3:33                                                         ` Andrea Arcangeli
2003-06-12  3:48                                                           ` Nick Piggin
2003-06-12  4:17                                                             ` Andrea Arcangeli
2003-06-12  4:41                                                               ` Nick Piggin
2003-06-12 16:06                                                         ` Chris Mason
2003-06-12 16:16                                                           ` Nick Piggin
2003-06-25 19:03                                               ` Chris Mason
2003-06-25 19:25                                                 ` Andrea Arcangeli
2003-06-25 20:18                                                   ` Chris Mason
2003-06-27  8:41                                                     ` write-caches, I/O stalls: MUST-FIX (was: [PATCH] io stalls) Matthias Andree
2003-06-26  5:48                                                 ` [PATCH] io stalls Nick Piggin
2003-06-26 11:48                                                   ` Chris Mason
2003-06-26 13:04                                                     ` Nick Piggin [this message]
2003-06-26 13:18                                                       ` Nick Piggin
2003-06-26 15:55                                                       ` Chris Mason
2003-06-27  1:21                                                         ` Nick Piggin
2003-06-27  1:39                                                           ` Chris Mason
2003-06-27  9:45                                                             ` Nick Piggin
2003-06-27 12:41                                                               ` Chris Mason
2003-06-12 11:57                                             ` Chris Mason
2003-06-04 10:43         ` -rc7 Re: Linux 2.4.21-rc6 Andrea Arcangeli
2003-06-04 11:01           ` Marc-Christian Petersen
2003-06-03 19:45 ` Config issue (CONFIG_X86_TSC) " Paul
2003-06-03 20:18   ` Jan-Benedict Glaw

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=3EFAEF71.1080109@cyberone.com.au \
    --to=piggin@cyberone.com.au \
    --cc=andrea@suse.de \
    --cc=axboe@suse.de \
    --cc=georgn@somanetworks.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.c.p@wolk-project.de \
    --cc=marcelo@conectiva.com.br \
    --cc=mason@suse.com \
    --cc=matthias.mueller@rz.uni-karlsruhe.de \
    /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).