public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@redhat.com>
To: Shaohua Li <shaohua.li@intel.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Jens Axboe <jaxboe@fusionio.com>,
	jmoyer@redhat.com
Subject: Re: [PATCH 2/2]block cfq: don't use atomic_t for cfq_group
Date: Thu, 23 Dec 2010 10:18:44 -0500	[thread overview]
Message-ID: <20101223151844.GD9502@redhat.com> (raw)
In-Reply-To: <1293072335.10593.22.camel@sli10-conroe>

On Thu, Dec 23, 2010 at 10:45:35AM +0800, Shaohua Li wrote:
> cfq_group->ref is used with queue_lock hold, the only exception is
> cfq_set_request, which looks like a bug to me, so ref doesn't need
> to be an atomic and atomic operation is slower.
> 

[..]
>  
> @@ -3683,12 +3685,13 @@ new_queue:
>  
>  	cfqq->allocated[rw]++;
>  	cfqq->ref++;
> +	cfqg = cfq_ref_get_cfqg(cfqq->cfqg);
>  
>  	spin_unlock_irqrestore(q->queue_lock, flags);
>  
>  	rq->elevator_private = cic;
>  	rq->elevator_private2 = cfqq;
> -	rq->elevator_private3 = cfq_ref_get_cfqg(cfqq->cfqg);
> +	rq->elevator_private3 = cfqg;

I think you can move every thing under spinlock. IOW, first set the
rq->elevator_private* fields and delay the release of spinlock. Few
days back I was also looking at wondering that why are we releasing
the spinlock early.

Thanks
Vivek

  reply	other threads:[~2010-12-23 15:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-23  2:45 [PATCH 2/2]block cfq: don't use atomic_t for cfq_group Shaohua Li
2010-12-23 15:18 ` Vivek Goyal [this message]
2010-12-24  0:40   ` Shaohua Li
2010-12-24 19:38     ` Vivek Goyal
2010-12-23 15:26 ` Jeff Moyer

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=20101223151844.GD9502@redhat.com \
    --to=vgoyal@redhat.com \
    --cc=jaxboe@fusionio.com \
    --cc=jmoyer@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shaohua.li@intel.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