Re: [PATCH 07/11] blkcg: make request_queue bypassing on allocation

From: Tejun Heo
Date: Fri Apr 13 2012 - 17:31:40 EST


On Fri, Apr 13, 2012 at 02:16:40PM -0700, Tejun Heo wrote:
> On Fri, Apr 13, 2012 at 02:05:48PM -0700, Tejun Heo wrote:
> > On Fri, Apr 13, 2012 at 04:55:01PM -0400, Vivek Goyal wrote:
> > > But neither seems to be the case here. So to make sure that blkg_lookup()
> > > under rcu will see the updated value of queue flag (bypass), are we
> > > relying on the fact that caller should see the DEAD flag and not go
> > > ahead with blkg_lookup()? If yes, atleast it is not obivious.
> >
> > We're relying on the fact that it doesn't matter anymore because all
> > blkgs will be shoot down in queue cleanup path which goes through rcu
> > free, which is different from deactivating individual policies. It
> > indeed is subtle. Umm... this is starting to get ridiculous. Why the
> > hell was megaraid messing with so many queues anyways?
>
> I suppose megaraid depends on sequential LUN scan which SCSI
> implements by creating sdev for each LUN, trying to see whether it
> actually exists and then destroys the sdev if not. Urgh.... so, we
> seem to be stuck with it.
>
> So, the current code is technically correct although subtle like hell.
> We can RCU defer blk_put_queue() from blk_cleanup_queue() using
> call_rcu() to make clear that RCU grace period is necessary there.
> Any better ideas?

I think I'm just gonna add comments clarifying why explicit
synchronize_rcu() isn't necessary there and the expected behavior (RCU
deferred freeing of any data structures which may be accessed under
RCU read lock) on queue cleanup path. Doing RCU deferral would
require double bouncing (first through RCU then through workqueue)
because blk_release_queue() requires process context. :(

Thanks.

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/