public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Ming Lei <ming.lei@canonical.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH 8/8] blk-mq: support per-distpatch_queue flush machinery
Date: Tue, 9 Sep 2014 11:48:56 -0700	[thread overview]
Message-ID: <20140909184856.GG16750@infradead.org> (raw)
In-Reply-To: <1410267949-21904-9-git-send-email-ming.lei@canonical.com>

> +	if (hctx) {
> +		int cmd_sz = q->tag_set->cmd_size;
> +		int node = hctx->numa_node;
> +
> +		fq = kzalloc_node(sizeof(*fq), GFP_KERNEL, node);
> +		if (!fq)
> +			goto failed;
> +
> +		rq_sz = round_up(rq_sz + cmd_sz, cache_line_size());
> +		fq->flush_rq = kzalloc_node(rq_sz, GFP_KERNEL, node);
> +		if (!fq->flush_rq)
> +			goto rq_failed;
> +
> +		spin_lock_init(&fq->mq_flush_lock);
> +	} else {
> +		fq = kzalloc(sizeof(*fq), GFP_KERNEL);
> +		if (!fq)
> +			goto failed;
> +
> +		fq->flush_rq = kzalloc(rq_sz, GFP_KERNEL);
> +		if (!fq->flush_rq)
> +			goto rq_failed;
> +	}

Seems like this would be a lot cleaner by passing the cmd_size and
node_id explicitly.  The added benefit would be that we could also
pass the node for the blk_init_queue_node() case.

> +static void __blk_mq_exit_flush(struct request_queue *q,
> +		unsigned free_end, unsigned int exit_end)
> +{
> +	struct blk_mq_hw_ctx *hctx;
> +	unsigned int k;
> +	struct blk_flush_queue *fq;
> +	struct blk_mq_tag_set *set = q->tag_set;
> +	unsigned start_idx = set->queue_depth;
> +
> +	queue_for_each_hw_ctx(q, hctx, k) {
> +		if (k >= free_end)
> +			break;
> +
> +		fq = hctx->fq;
> +		if (k < exit_end && set->ops->exit_request)
> +			set->ops->exit_request(set->driver_data,
> +					fq->flush_rq, k,
> +					start_idx + k);
> +
> +		blk_free_flush_queue(fq);
> +	}

Can we merge the mq init/exit case into some existing for each hctx
loop in blk-mq?

  reply	other threads:[~2014-09-09 18:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-09 13:05 [PATCH 0/8] block: per-distpatch_queue flush machinery Ming Lei
2014-09-09 13:05 ` [PATCH 1/8] blk-mq: allocate flush_rq in blk_mq_init_flush() Ming Lei
2014-09-09 18:35   ` Christoph Hellwig
2014-09-09 13:05 ` [PATCH 2/8] block: introduce blk_init_flush and its pair Ming Lei
2014-09-09 18:36   ` Christoph Hellwig
2014-09-09 13:05 ` [PATCH 3/8] block: move flush initialized stuff to blk_flush_init Ming Lei
2014-09-09 18:37   ` Christoph Hellwig
2014-09-09 13:05 ` [PATCH 4/8] block: avoid to use q->flush_rq directly Ming Lei
2014-09-09 18:38   ` Christoph Hellwig
2014-09-09 13:05 ` [PATCH 5/8] block: introduce blk_flush_queue to drive flush machinery Ming Lei
2014-09-09 18:43   ` Christoph Hellwig
2014-09-09 18:55     ` Jens Axboe
2014-09-10  1:25       ` Ming Lei
2014-09-10  1:23     ` Ming Lei
2014-09-09 13:05 ` [PATCH 6/8] block: flush: avoid to figure out flush queue unnecessarily Ming Lei
2014-09-09 18:44   ` Christoph Hellwig
2014-09-09 13:05 ` [PATCH 7/8] block: introduce 'blk_mq_ctx' parameter to blk_get_flush_queue Ming Lei
2014-09-09 13:05 ` [PATCH 8/8] blk-mq: support per-distpatch_queue flush machinery Ming Lei
2014-09-09 18:48   ` Christoph Hellwig [this message]
2014-09-10  1:40     ` Ming Lei
2014-09-10 19:02       ` Christoph Hellwig
2014-09-10 23:53         ` Ming Lei
2014-09-09 15:20 ` [PATCH 0/8] block: " Christoph Hellwig
2014-09-09 15:38   ` 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=20140909184856.GG16750@infradead.org \
    --to=hch@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=ming.lei@canonical.com \
    /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