From: Jens Axboe <axboe@fb.com>
To: "Paolo Valente" <paolo.valente@unimore.it>,
"Matias Bjørling" <m@bjorling.me>,
"Arianna Avanzini" <avanzini@google.com>
Cc: Akinobu Mita <akinobu.mita@gmail.com>,
"Luis R. Rodriguez" <mcgrof@suse.com>,
Ming Lei <ming.lei@canonical.com>,
Mike Krinkin <krinkin.m.u@gmail.com>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH BUGFIX 1/3] null_blk: set a separate timer for each command
Date: Mon, 2 Nov 2015 09:14:38 -0700 [thread overview]
Message-ID: <56378BEE.2070907@fb.com> (raw)
In-Reply-To: <1446474673-2566-2-git-send-email-paolo.valente@unimore.it>
On 11/02/2015 07:31 AM, Paolo Valente wrote:
> For the Timer IRQ mode (i.e., when command completions are delayed),
> there is one timer for each CPU. Each of these timers
> . has a completion queue associated with it, containing all the
> command completions to be executed when the timer fires;
> . is set, and a new completion-to-execute is inserted into its
> completion queue, every time the dispatch code for a new command
> happens to be executed on the CPU related to the timer.
>
> This implies that, if the dispatch of a new command happens to be
> executed on a CPU whose timer has already been set, but has not yet
> fired, then the timer is set again, to the completion time of the
> newly arrived command. When the timer eventually fires, all its queued
> completions are executed.
>
> This way of handling delayed command completions entails the following
> problem: if more than one command completion is inserted into the
> queue of a timer before the timer fires, then the expiration time for
> the timer is moved forward every time each of these completions is
> enqueued. As a consequence, only the last completion enqueued enjoys a
> correct execution time, while all previous completions are unjustly
> delayed until the last completion is executed (and at that time they
> are executed all together).
>
> Specifically, if all the above completions are enqueued almost at the
> same time, then the problem is negligible. On the opposite end, if
> every completion is enqueued a while after the previous completion was
> enqueued (in the extreme case, it is enqueued only right before the
> timer would have expired), then every enqueued completion, except for
> the last one, experiences an inflated delay, proportional to the number
> of completions enqueued after it. In the end, commands, and thus I/O
> requests, may be completed at an arbitrarily lower rate than the
> desired one.
>
> This commit addresses this issue by replacing per-CPU timers with
> per-command timers, i.e., by associating an individual timer with each
> command.
Functionally the patch looks fine. My only worry is that a timer per
command would be an unnecessary slowdown compared to pushing one timer
forward. The problem should be fixable by still doing that, just
maintaining next-expire instead. Maybe something that would still
roughly be precise enough, while still getting some completion batching
going? Or maybe that would be slower, and the individual timers are
still better.
Comments?
--
Jens Axboe
next prev parent reply other threads:[~2015-11-02 16:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-02 14:31 [PATCH BUGFIX 0/3] null_blk: fix throughout losses and hangs Paolo Valente
2015-11-02 14:31 ` [PATCH BUGFIX 1/3] null_blk: set a separate timer for each command Paolo Valente
2015-11-02 16:14 ` Jens Axboe [this message]
2015-11-03 9:01 ` Paolo Valente
2015-11-29 17:27 ` Paolo Valente
2015-11-30 15:55 ` Jens Axboe
2015-12-01 10:48 ` [PATCH BUGFIX V2 0/3] null_blk: fix throughput losses and hangs Paolo Valente
2015-12-01 10:48 ` [PATCH BUGFIX V2 1/3] null_blk: set a separate timer for each command Paolo Valente
2015-12-01 10:48 ` [PATCH BUGFIX V2 2/3] null_blk: guarantee device restart in all irq modes Paolo Valente
2015-12-01 10:48 ` [PATCH BUGFIX V2 3/3] null_blk: change type of completion_nsec to unsigned long Paolo Valente
2015-12-01 17:52 ` [PATCH BUGFIX V2 0/3] null_blk: fix throughput losses and hangs Jens Axboe
2015-11-02 14:31 ` [PATCH BUGFIX 2/3] null_blk: guarantee device restart in all irq modes Paolo Valente
2015-11-02 16:25 ` Jens Axboe
2015-11-03 9:02 ` Paolo Valente
2015-11-02 14:31 ` [PATCH BUGFIX 3/3] null_blk: change type of completion_nsec to unsigned long Paolo Valente
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=56378BEE.2070907@fb.com \
--to=axboe@fb.com \
--cc=akinobu.mita@gmail.com \
--cc=avanzini@google.com \
--cc=krinkin.m.u@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=m@bjorling.me \
--cc=mcgrof@suse.com \
--cc=ming.lei@canonical.com \
--cc=paolo.valente@unimore.it \
/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).