public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: Chris Mason <mason@suse.com>
Cc: Nick Piggin <piggin@cyberone.com.au>,
	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: Wed, 25 Jun 2003 21:25:23 +0200	[thread overview]
Message-ID: <20030625192523.GB19940@dualathlon.random> (raw)
In-Reply-To: <1056567822.10097.133.camel@tiny.suse.com>

On Wed, Jun 25, 2003 at 03:03:43PM -0400, Chris Mason wrote:
> Hello all,
> 
> [ short version, the patch attached should fix io latencies in 2.4.21. 
> Please review and/or give it a try ]
>  
> My last set of patches was directed at reducing the latencies in
> __get_request_wait, which really helped reduce stalls when you had lots
> of io to one device and balance_dirty() was causing pauses while you
> tried to do io to other devices.
> 
> But, a streaming write could still starve reads to the same device,
> mostly because the read would have to send down any huge merged writes
> that were before it in the queue.
> 
> Andrea's kernel has a fix for this too, he limits the total number of
> sectors that can be in the request queue at any given time.  But, his
> patches change blk_finished_io, both in the arguments it takes and the
> side effects of calling it.  I don't think we can merge his current form
> without breaking external drivers.
> 
> So, I added a can_throttle flag to the queue struct, drivers can enable
> it if they are going to call the new blk_started_sectors and
> blk_finished_sectors funcs any time they call blk_{started,finished}_io,
> and these do all the -aa style sector throttling.
> 
> There were a few other small changes to Andrea's patch, he wasn't
> setting q->full when get_request decided there were too many sectors in

wasn't is really in the past, because I'm doing it in 2.4.21rc8aa1 and
in my latest status.

> flight.  This resulted in large latencies in __get_request_wait.  He was
> also unconditionally clearing q->full in blkdev_release_request, my code
> only clears q->full when all the waiters are gone.

my current code including the older 2.4.21rc8aa1 does that too, merged
from your previous patches.

> I changed generic_unplug_device to zero the elevator_sequence field of
> the last request on the queue.  This means there won't be any merges
> with requests pending once an unplug is done, and helps limit the number
> of sectors that need to be sent down during the run_task_queue(&tq_disk)
> in wait_on_buffer.

this sounds like an hack, forbidding merges is pretty bad for
performance in general, of course most of the merging happens in between
the unplugs, but during heavy I/O with frequent unplugs from many
readers this may hurt performance. And as you said this mostly has the
advantage of limiting the size of the queue, like I enforce in my tree
with the elevator-lowlatency. I doubt this is right.

> I lowered the -aa default limit on sectors in flight from 4MB to 2MB. 

I got a few complains for performance slowdown, originally it was 2MB,
so I increased it to 4, from 4M it should be enough for most hardware.

> We probably want an elvtune for it, large arrays with writeback cache
> should be able to tolerate larger values.

Yes, it largely depends on the speed of the device.

> There's still a little work left to do, this patch enables sector
> throttling for scsi and IDE.  cciss, DAC960 and cpqarray need
> modification too (99% done already in -aa).  No sense in doing that
> until after the bulk of the patch is reviewed though.
> 
> As before, most of the code here is from Andrea and Nick, I've just
> wrapped a lot of duct tape around it and done some tweaking.  The
> primary pieces are:
> 
> fix-pausing (andrea, corner cases where wakeups are missed)
> elevator-low-latency (andrea, limit sectors in flight)
> queue_full (Nick, fairness in __get_request_wait)
> 
> I've removed my latency stats for __get_request_wait in hopes of making
> it a better merging candidate.

this is very similar to my status in -aa, exept for the hack that
forbids merging which I think is wrong and the fact you miss the 
wake_up_nr that I added to give a meaning to the batching again and that
you don't avoid the unplugs in get_request_wait_wakeup until the queue
is empty. I mean this:

+static void get_request_wait_wakeup(request_queue_t *q, int rw)
+{
+	/*
+	 * avoid losing an unplug if a second __get_request_wait did the
+	 * generic_unplug_device while our __get_request_wait was
running
+	 * w/o the queue_lock held and w/ our request out of the queue.
+	 */
+	if (q->rq[rw].count == 0 && waitqueue_active(&q->wait_for_requests[rw]))
+		__generic_unplug_device(q);
+}
+

you said last week the above is racy and it even hanged your box, could
you elaborate? The above is in 2.4.21rc8aa1 and it works fine so far
(though especially the race in wait_for_request is never been known to
be reproducible)

thanks,

Andrea

  reply	other threads:[~2003-06-25 19:11 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 [this message]
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
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=20030625192523.GB19940@dualathlon.random \
    --to=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 \
    --cc=piggin@cyberone.com.au \
    /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