On Thu, 2017-08-31 at 11:43 +0800, Ming Lei wrote:
> On Wed, Aug 30, 2017 at 04:34:47PM +0000, Bart Van Assche wrote:
> > On Sun, 2017-08-27 at 00:33 +0800, Ming Lei wrote:
> > > diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
> > > index 50c6485cb04f..7b7a366a97f3 100644
> > > --- a/include/linux/blk-mq.h
> > > +++ b/include/linux/blk-mq.h
> > > @@ -30,6 +30,8 @@ struct blk_mq_hw_ctx {
> > >  
> > >   struct sbitmap          ctx_map;
> > >  
> > > + struct blk_mq_ctx       *dispatch_from;
> > > +
> > >   struct blk_mq_ctx       **ctxs;
> > >   unsigned int            nr_ctx;
> > 
> > Hello Ming,
> > 
> > Are you relying here on the fact that the per-CPU queues are never
> > reallocated, even if CPU hot-plugging occurs? Sorry but that seems fragile
> > to me. I would like to see 'dispatch_from' be converted into an integer. It
> > is easy to check whether an integer software queue index is out of range
> > but it's not that easy to check whether a pointer became invalid.
> 
> If CPU hotplug happens, the instance of 'struct blk_mq_ctx' for that
> CPU is still there and its index won't change from being setup because
> its lifetime is same with 'struct request_queue', blk_mq_hctx_notify_dead()
> just flushes the sw queue when the CPU is going away.
> 
> So we don't need to pay special attention to CPU hotplug here, please let
> me know if you are fine now.

Hello Ming,

That's also how I interpret the blk-mq source code. But it's probably a good
idea to add a short comment that the dispatch_from pointer is not affected by
CPU hot-plugging. Anyway, with or without such a comment:

Reviewed-by: Bart Van Assche <[email protected]>

Reply via email to