All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: stern@rowland.harvard.edu, James.Bottomley@HansenPartnership.com,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Problems with the block-layer timeouts
Date: Fri, 7 Nov 2008 12:24:50 +0100	[thread overview]
Message-ID: <20081107112449.GN21867@kernel.dk> (raw)
In-Reply-To: <20081107130552K.fujita.tomonori@lab.ntt.co.jp>

On Fri, Nov 07 2008, FUJITA Tomonori wrote:
> On Thu, 6 Nov 2008 08:23:54 +0100
> Jens Axboe <jens.axboe@oracle.com> wrote:
> 
> > On Thu, Nov 06 2008, FUJITA Tomonori wrote:
> > > On Mon, 3 Nov 2008 09:52:48 +0100
> > > Jens Axboe <jens.axboe@oracle.com> wrote:
> > > 
> > > > > In blk_del_timer(), there's no reason to test q->rq_timed_out_fn.  If 
> > > > > the method pointer is NULL then req->deadline would be 0 anyway.  In 
> > > > > addition, req->deadline should be set to 0 and the end of the routine, 
> > > > > just in case req gets requeued.
> > > > > 
> > > > > In blk_add_timer(), the line
> > > > > 
> > > > > 	expiry = round_jiffies(req->deadline);
> > > > > 
> > > > > is not optimal.  round_jiffies() will sometimes round a value _down_ to
> > > > > the nearest second.  But blk_rq_timed_out_timer() tests whether
> > > > > req->deadline is in the past -- and if the deadline was rounded down
> > > > > then this won't be true the first time through.  You wind up getting an
> > > > > unnecessary timer interrupt.  Instead there should be a
> > > > > round_jiffies_up() utility routine, and it should be used in both
> > > > > blk_add_timer() and blk_rq_timed_out_timer().
> > > > 
> > > > Very good point, we do indeed want a round_jiffies_up() for this!
> > > 
> > > Just out of curiosity, why do we need to use round_jiffies here? We
> > > didn't do that for SCSI, right?
> > 
> > We don't have to, but given that we don't care about exact timeouts, we
> > may as well. It's not a new thing, we've done that since pretty much the
> > beginning of the generic timeout development.
> 
> I'm not sure that the users of the timeout feature can control exact
> timeouts because the block layer doesn't let the users directly play
> with the timer. elv_dequeue_request() is not the exact time that the
> users want to start the timer. Instead, the block layer hides the
> details behind the elevator (note that as I said before, I think that
> it's the right thing). So the round_jiffies in the block layer doesn't
> make sense to me. I prefer remove them instead of adding a bunch of
> round_jiffies_up_* (I bet that some of them will never be used).

I don't understand your concern, to be honest. We only need to round up
once, and that is when we add/mod the timer. And we do that simply to
play nice and group the timout with other timers, to save a bit of
power.

-- 
Jens Axboe


  reply	other threads:[~2008-11-07 11:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-01 16:54 Problems with the block-layer timeouts Alan Stern
2008-11-02 20:35 ` Mike Anderson
2008-11-03  8:52 ` Jens Axboe
2008-11-03 14:18   ` James Smart
2008-11-03 17:23     ` Jens Axboe
2008-11-03 15:59   ` Alan Stern
2008-11-03 16:39     ` Tejun Heo
2008-11-03 17:07       ` Alan Stern
2008-11-03 17:27       ` Jens Axboe
2008-11-04  3:01         ` Tejun Heo
2008-11-06  0:01   ` FUJITA Tomonori
2008-11-06  7:23     ` Jens Axboe
2008-11-07  4:05       ` FUJITA Tomonori
2008-11-07 11:24         ` Jens Axboe [this message]
2008-11-11  6:54           ` FUJITA Tomonori
2008-11-11 17:11             ` Alan Stern
2008-11-11 17:11               ` Alan Stern
2008-11-11 19:19               ` Jens Axboe
2008-11-12  2:08                 ` FUJITA Tomonori
2008-11-13 10:34                   ` Jens Axboe
2008-11-17  3:48                     ` FUJITA Tomonori

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=20081107112449.GN21867@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.