linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
	Hannes Reinecke <hare@suse.com>, Christoph Hellwig <hch@lst.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	John Garry <john.garry@huawei.com>
Subject: Re: [PATCH V6 1/8] blk-mq: assign rq->tag in blk_mq_get_driver_tag
Date: Tue, 7 Apr 2020 19:14:05 +0200	[thread overview]
Message-ID: <20200407171405.GA5614@lst.de> (raw)
In-Reply-To: <20200407092901.314228-2-ming.lei@redhat.com>

On Tue, Apr 07, 2020 at 05:28:54PM +0800, Ming Lei wrote:
> @@ -472,14 +462,18 @@ static void __blk_mq_free_request(struct request *rq)
>  	struct request_queue *q = rq->q;
>  	struct blk_mq_ctx *ctx = rq->mq_ctx;
>  	struct blk_mq_hw_ctx *hctx = rq->mq_hctx;
> -	const int sched_tag = rq->internal_tag;
> +	const int tag = rq->internal_tag;
> +	bool has_sched = !!hctx->sched_tags;
>  
>  	blk_pm_mark_last_busy(rq);
>  	rq->mq_hctx = NULL;
> +	if (!has_sched)
> +		blk_mq_put_tag(hctx->tags, ctx, tag);
> +	else if (rq->tag >= 0)
>  		blk_mq_put_tag(hctx->tags, ctx, rq->tag);
> +
> +	if (has_sched)
> +		blk_mq_put_tag(hctx->sched_tags, ctx, tag);

This looks weird to me.  Why not simply:

	if (hctx->sched_tags) {
		if (rq->tag >= 0)
			blk_mq_put_tag(hctx->tags, ctx, rq->tag);
		blk_mq_put_tag(hctx->sched_tags, ctx, rq->internal_tag);
	} else {
		blk_mq_put_tag(hctx->tags, ctx, rq->internal_tag);
	}


> @@ -1037,14 +1031,21 @@ bool blk_mq_get_driver_tag(struct request *rq)

FYI, it seems like blk_mq_get_driver_tag can be marked static.

Otherwise this looks pretty sensible to me.

  reply	other threads:[~2020-04-07 17:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-07  9:28 [PATCH V6 0/8] blk-mq: improvement CPU hotplug Ming Lei
2020-04-07  9:28 ` [PATCH V6 1/8] blk-mq: assign rq->tag in blk_mq_get_driver_tag Ming Lei
2020-04-07 17:14   ` Christoph Hellwig [this message]
2020-04-08  1:38     ` Ming Lei
2020-04-07  9:28 ` [PATCH V6 2/8] blk-mq: add new state of BLK_MQ_S_INACTIVE Ming Lei
2020-04-07 17:14   ` Christoph Hellwig
2020-04-07  9:28 ` [PATCH V6 3/8] blk-mq: prepare for draining IO when hctx's all CPUs are offline Ming Lei
2020-04-07  9:28 ` [PATCH V6 4/8] blk-mq: stop to handle IO and drain IO before hctx becomes inactive Ming Lei
2020-04-07  9:28 ` [PATCH V6 5/8] block: add blk_end_flush_machinery Ming Lei
2020-04-07  9:28 ` [PATCH V6 6/8] blk-mq: re-submit IO in case that hctx is inactive Ming Lei
2020-04-07  9:29 ` [PATCH V6 7/8] blk-mq: handle requests dispatched from IO scheduler in case of inactive hctx Ming Lei
2020-04-07  9:29 ` [PATCH V6 8/8] block: deactivate hctx when the hctx is actually inactive Ming Lei
2020-04-08 12:40 ` [PATCH V6 0/8] blk-mq: improvement CPU hotplug Daniel Wagner
2020-04-08 13:01   ` John Garry
2020-04-08 13:10     ` Daniel Wagner
2020-04-08 13:29       ` John Garry
2020-04-08 15:14         ` Daniel Wagner
2020-04-08 16:56           ` John Garry
2020-04-08 13:25   ` Ming Lei

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=20200407171405.GA5614@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=hare@suse.com \
    --cc=john.garry@huawei.com \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).