public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: malahal@us.ibm.com
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH] block: optimizations in blk_rq_timed_out_timer()
Date: Wed, 29 Oct 2008 14:26:15 +0100	[thread overview]
Message-ID: <20081029132614.GD31673@kernel.dk> (raw)
In-Reply-To: <20081029060625.GA5080@us.ibm.com>

On Tue, Oct 28 2008, malahal@us.ibm.com wrote:
> FUJITA Tomonori [fujita.tomonori@lab.ntt.co.jp] wrote:
> > On Tue, 28 Oct 2008 11:22:43 -0700
> > malahal@us.ibm.com wrote:
> > 
> > > Now the rq->deadline can't be zero if the request is in the
> > > timeout_list, so there is no need to have next_set. There is no need to
> > > access a request's deadline field if blk_rq_timed_out is called on it.
> > > 
> > > Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
> > > 
> > > diff -r a6ae42397ede block/blk-timeout.c
> > > --- a/block/blk-timeout.c	Thu Oct 23 11:48:45 2008 -0700
> > > +++ b/block/blk-timeout.c	Fri Oct 24 17:08:24 2008 -0700
> > > @@ -118,7 +118,7 @@
> > >  void blk_rq_timed_out_timer(unsigned long data)
> > >  {
> > >  	struct request_queue *q = (struct request_queue *) data;
> > > -	unsigned long flags, uninitialized_var(next), next_set = 0;
> > > +	unsigned long flags, next = 0;
> > >  	struct request *rq, *tmp;
> > >  
> > >  	spin_lock_irqsave(q->queue_lock, flags);
> > > @@ -133,15 +133,13 @@
> > >  			if (blk_mark_rq_complete(rq))
> > >  				continue;
> > >  			blk_rq_timed_out(rq);
> > > +		} else {
> > > +			if (!next || time_after(next, rq->deadline))
> > > +				next = rq->deadline;
> > 
> > Hmm, blk_rq_timed_out(rq) could put the rq back to q->timeout_list. We
> > need to take care of the rq->deadline like this?
> 
> If it is put back on the list, it would be placed at the end of the list
> so we will get to work on it again in the list traversal. There is no
> need to access it now.
> 
> > 
> > >  			if (blk_mark_rq_complete(rq))
> > >  				continue;
> > >  			blk_rq_timed_out(rq);
> > > +		}
> > >
> > > +		if (!next || time_after(next, rq->deadline))
> > > +			next = rq->deadline;
> > 
> > But if blk_rq_timed_out calls __blk_complete_request, we don't want to
> > touch the rq here, I guess.
> 
> Yes, we should not access it although I don't think the request can be
> freed while the existing code is accessing the deadline field. What 
> likely can happen is that we may call mod_timer with jiffies that is
> older than current which would call the timer immediately...

That would not call the timer immediately, that will not call it until
jiffies reaches that value again. So you're looking at a minimum of 49
days :-)

-- 
Jens Axboe


  reply	other threads:[~2008-10-29 13:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-28 18:22 [PATCH] block: optimizations in blk_rq_timed_out_timer() malahal
2008-10-29  4:07 ` FUJITA Tomonori
2008-10-29  6:06   ` malahal
2008-10-29 13:26     ` Jens Axboe [this message]
2008-10-29 18:21       ` malahal
2008-10-30  2:33     ` FUJITA Tomonori
2008-10-30  7:49       ` Jens Axboe
2008-10-30  8:29         ` FUJITA Tomonori
2008-10-30  8:55           ` Jens Axboe
2008-10-30 10:29             ` 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=20081029132614.GD31673@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=linux-scsi@vger.kernel.org \
    --cc=malahal@us.ibm.com \
    /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