Re: [PATCH V7 1/9] blk-mq: grab .q_usage_counter when queuing request from plug code path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 24, 2019 at 06:18:34PM +0200, Christoph Hellwig wrote:
> On Wed, Apr 24, 2019 at 07:02:13PM +0800, Ming Lei wrote:
> >  		if (rq->mq_hctx != this_hctx || rq->mq_ctx != this_ctx) {
> >  			if (this_hctx) {
> >  				trace_block_unplug(this_q, depth, !from_schedule);
> > +
> > +				percpu_ref_get(&this_q->q_usage_counter);
> >  				blk_mq_sched_insert_requests(this_hctx, this_ctx,
> >  								&rq_list,
> >  								from_schedule);
> > +				percpu_ref_put(&this_q->q_usage_counter);
> >  			}
> >  
> >  			this_q = rq->q;
> > @@ -1757,8 +1760,11 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
> >  	 */
> >  	if (this_hctx) {
> >  		trace_block_unplug(this_q, depth, !from_schedule);
> > +
> > +		percpu_ref_get(&this_q->q_usage_counter);
> >  		blk_mq_sched_insert_requests(this_hctx, this_ctx, &rq_list,
> >  						from_schedule);
> > +		percpu_ref_put(&this_q->q_usage_counter);
> 
> Why don't we push this into blk_mq_sched_insert_requests?  Yes, it
> would need a request_queue argument, but that still seems saner
> than duplicating it in both callers.

It isn't in other callers of blk_mq_sched_insert_requests(), it is just
needed in some corner case like flush plug context.

For other callers of blk_mq_sched_insert_requests(), it is guaranteed
that request queue's ref is held.

Thanks,
Ming



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux