From: Vivek Goyal <vgoyal@redhat.com>
To: Paul Bolle <pebolle@tiscali.nl>
Cc: Jens Axboe <axboe@kernel.dk>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/5] CFQ: use proper locking for cache of last hit cic
Date: Wed, 8 Jun 2011 14:42:54 -0400 [thread overview]
Message-ID: <20110608184254.GD1150@redhat.com> (raw)
In-Reply-To: <1307557130.2783.5.camel@t41.thuisdomein>
On Wed, Jun 08, 2011 at 08:18:44PM +0200, Paul Bolle wrote:
> On Mon, 2011-06-06 at 05:06 +0200, Jens Axboe wrote:
> > On 2011-06-05 18:26, Paul Bolle wrote:
> > > @@ -2704,8 +2706,13 @@ static void __cfq_exit_single_io_context(struct cfq_data *cfqd,
> > > smp_wmb();
> > > cic->key = cfqd_dead_key(cfqd);
> > >
> > > - if (ioc->last_cic == cic)
> > > + spin_lock_irqsave(&ioc->lock, flags);
> > > + rcu_read_lock();
> > > + last_cic = rcu_dereference(ioc->last_cic);
> > > + rcu_read_unlock();
> > > + if (last_cic == cic)
> > > rcu_assign_pointer(ioc->last_cic, NULL);
> > > + spin_unlock_irqrestore(&ioc->lock, flags);
> >
> > We don't need the ioc->lock for checking the cache, it would in fact
> > defeat the purpose of using RCU.
>
> Just to show that I'm RCU-challenged, is that because:
> 1) my use of locking on ioc->lock defends for a race that is not
> actually possible; or
> 2) the worst thing that could happen is that some new and correct value
> of ioc->last_cic will be replaced with NULL, which is simply not a big
> deal?
I don't understand this point. All ioc->ioc_data updates are under
ioc->lock except the one __cfq_exit_single_io_context() and that's what
jens patch fixed. So clearly there was atleast one race where we were
doing a value update without taking appropriate lock.
Why do you think that some new and correct value will be replaced
by NULL?
Thanks
Vivek
next prev parent reply other threads:[~2011-06-08 18:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-05 16:26 [PATCH 5/5] CFQ: use proper locking for cache of last hit cic Paul Bolle
2011-06-05 16:59 ` Paul E. McKenney
2011-06-06 3:06 ` Jens Axboe
2011-06-08 18:18 ` Paul Bolle
2011-06-08 18:37 ` Paul E. McKenney
2011-06-08 18:42 ` Vivek Goyal [this message]
2011-06-08 19:32 ` Paul Bolle
2011-06-08 20:07 ` Vivek Goyal
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=20110608184254.GD1150@redhat.com \
--to=vgoyal@redhat.com \
--cc=axboe@kernel.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=pebolle@tiscali.nl \
/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.