All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Bart Van Assche <bvanassche@acm.org>, Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Jaegeuk Kim <jaegeuk@kernel.org>,
	Christoph Hellwig <hch@lst.de>, Ming Lei <ming.lei@redhat.com>,
	Mike Snitzer <snitzer@kernel.org>
Subject: Re: [PATCH v2 02/12] block: Send flush requests to the I/O scheduler
Date: Mon, 10 Apr 2023 16:46:57 +0900	[thread overview]
Message-ID: <af4aeeea-79b2-8b0d-df8b-63f5ae6752d7@kernel.org> (raw)
In-Reply-To: <20230407235822.1672286-3-bvanassche@acm.org>

On 4/8/23 08:58, Bart Van Assche wrote:
> Prevent that zoned writes with the FUA flag set are reordered against each
> other or against other zoned writes. Separate the I/O scheduler members
> from the flush members in struct request since with this patch applied a
> request may pass through both an I/O scheduler and the flush machinery.
> 
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Damien Le Moal <damien.lemoal@opensource.wdc.com>
> Cc: Ming Lei <ming.lei@redhat.com>
> Cc: Mike Snitzer <snitzer@kernel.org>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  block/blk-flush.c      |  3 ++-
>  block/blk-mq.c         | 11 ++++-------
>  block/mq-deadline.c    |  2 +-
>  include/linux/blk-mq.h | 27 +++++++++++----------------
>  4 files changed, 18 insertions(+), 25 deletions(-)
> 
> diff --git a/block/blk-flush.c b/block/blk-flush.c
> index 53202eff545e..e0cf153388d8 100644
> --- a/block/blk-flush.c
> +++ b/block/blk-flush.c
> @@ -432,7 +432,8 @@ void blk_insert_flush(struct request *rq)
>  	 */
>  	if ((policy & REQ_FSEQ_DATA) &&
>  	    !(policy & (REQ_FSEQ_PREFLUSH | REQ_FSEQ_POSTFLUSH))) {
> -		blk_mq_request_bypass_insert(rq, false, true);
> +		blk_mq_sched_insert_request(rq, /*at_head=*/false,
> +					    /*run_queue=*/true, /*async=*/true);
>  		return;
>  	}
>  
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index fefc9a728e0e..250556546bbf 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -390,8 +390,7 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data,
>  		INIT_HLIST_NODE(&rq->hash);
>  		RB_CLEAR_NODE(&rq->rb_node);
>  
> -		if (!op_is_flush(data->cmd_flags) &&
> -		    e->type->ops.prepare_request) {
> +		if (e->type->ops.prepare_request) {
>  			e->type->ops.prepare_request(rq);
>  			rq->rq_flags |= RQF_ELVPRIV;
>  		}
> @@ -452,13 +451,11 @@ static struct request *__blk_mq_alloc_requests(struct blk_mq_alloc_data *data)
>  		data->rq_flags |= RQF_ELV;
>  
>  		/*
> -		 * Flush/passthrough requests are special and go directly to the
> -		 * dispatch list. Don't include reserved tags in the
> -		 * limiting, as it isn't useful.
> +		 * Do not limit the depth for passthrough requests nor for
> +		 * requests with a reserved tag.
>  		 */
> -		if (!op_is_flush(data->cmd_flags) &&
> +		if (e->type->ops.limit_depth &&
>  		    !blk_op_is_passthrough(data->cmd_flags) &&
> -		    e->type->ops.limit_depth &&
>  		    !(data->flags & BLK_MQ_REQ_RESERVED))
>  			e->type->ops.limit_depth(data->cmd_flags, data);
>  	}
> diff --git a/block/mq-deadline.c b/block/mq-deadline.c
> index f10c2a0d18d4..d885ccf49170 100644
> --- a/block/mq-deadline.c
> +++ b/block/mq-deadline.c
> @@ -789,7 +789,7 @@ static void dd_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
>  
>  	prio = ioprio_class_to_prio[ioprio_class];
>  	per_prio = &dd->per_prio[prio];
> -	if (!rq->elv.priv[0]) {
> +	if (!rq->elv.priv[0] && !(rq->rq_flags & RQF_FLUSH_SEQ)) {
>  		per_prio->stats.inserted++;
>  		rq->elv.priv[0] = (void *)(uintptr_t)1;
>  	}

Given that this change has nothing specific to zoned devices, you could rewrite
the commit message to mention that. And are bfq and kyber OK with this change as
well ?

Also, to be consistent with this change, shouldn't blk_mq_sched_bypass_insert()
be updated as well ? That function is called from blk_mq_sched_insert_request().

> diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
> index 06caacd77ed6..5e6c79ad83d2 100644
> --- a/include/linux/blk-mq.h
> +++ b/include/linux/blk-mq.h
> @@ -169,25 +169,20 @@ struct request {
>  		void *completion_data;
>  	};
>  
> -
>  	/*
>  	 * Three pointers are available for the IO schedulers, if they need
> -	 * more they have to dynamically allocate it.  Flush requests are
> -	 * never put on the IO scheduler. So let the flush fields share
> -	 * space with the elevator data.
> +	 * more they have to dynamically allocate it.
>  	 */
> -	union {
> -		struct {
> -			struct io_cq		*icq;
> -			void			*priv[2];
> -		} elv;
> -
> -		struct {
> -			unsigned int		seq;
> -			struct list_head	list;
> -			rq_end_io_fn		*saved_end_io;
> -		} flush;
> -	};
> +	struct {
> +		struct io_cq		*icq;
> +		void			*priv[2];
> +	} elv;
> +
> +	struct {
> +		unsigned int		seq;
> +		struct list_head	list;
> +		rq_end_io_fn		*saved_end_io;
> +	} flush;
>  
>  	union {
>  		struct __call_single_data csd;


  reply	other threads:[~2023-04-10  7:47 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-07 23:58 [PATCH v2 00/12] Submit zoned writes in order Bart Van Assche
2023-04-07 23:58 ` [PATCH v2 01/12] block: Send zoned writes to the I/O scheduler Bart Van Assche
2023-04-10  7:42   ` Damien Le Moal
2023-04-10 16:35     ` Bart Van Assche
2023-04-07 23:58 ` [PATCH v2 02/12] block: Send flush requests " Bart Van Assche
2023-04-10  7:46   ` Damien Le Moal [this message]
2023-04-11  0:15     ` Bart Van Assche
2023-04-11  6:38       ` Christoph Hellwig
2023-04-11 17:13         ` Bart Van Assche
2023-04-07 23:58 ` [PATCH v2 03/12] block: Send requeued " Bart Van Assche
2023-04-10  7:53   ` Damien Le Moal
2023-04-10 16:59     ` Bart Van Assche
2023-04-11 12:38   ` Christoph Hellwig
2023-04-11 17:17     ` Bart Van Assche
2023-04-11 13:14   ` Christoph Hellwig
2023-04-07 23:58 ` [PATCH v2 04/12] block: Requeue requests if a CPU is unplugged Bart Van Assche
2023-04-10  7:54   ` Damien Le Moal
2023-04-11 12:40   ` Christoph Hellwig
2023-04-11 17:18     ` Bart Van Assche
2023-04-07 23:58 ` [PATCH v2 05/12] block: One requeue list per hctx Bart Van Assche
2023-04-10  7:58   ` Damien Le Moal
2023-04-10 17:04     ` Bart Van Assche
2023-04-07 23:58 ` [PATCH v2 06/12] block: Preserve the order of requeued requests Bart Van Assche
2023-04-10  8:01   ` Damien Le Moal
2023-04-11 12:43   ` Christoph Hellwig
2023-04-07 23:58 ` [PATCH v2 07/12] block: Make it easier to debug zoned write reordering Bart Van Assche
2023-04-10  8:06   ` Damien Le Moal
2023-04-07 23:58 ` [PATCH v2 08/12] block: mq-deadline: Simplify deadline_skip_seq_writes() Bart Van Assche
2023-04-10  8:07   ` Damien Le Moal
2023-04-07 23:58 ` [PATCH v2 09/12] block: mq-deadline: Disable head insertion for zoned writes Bart Van Assche
2023-04-10  8:10   ` Damien Le Moal
2023-04-10 17:09     ` Bart Van Assche
2023-04-11  6:44       ` Christoph Hellwig
2023-04-07 23:58 ` [PATCH v2 10/12] block: mq-deadline: Introduce a local variable Bart Van Assche
2023-04-10  8:11   ` Damien Le Moal
2023-04-07 23:58 ` [PATCH v2 11/12] block: mq-deadline: Fix a race condition related to zoned writes Bart Van Assche
2023-04-10  8:16   ` Damien Le Moal
2023-04-10 17:23     ` Bart Van Assche
2023-04-07 23:58 ` [PATCH v2 12/12] block: mq-deadline: Handle requeued requests correctly Bart Van Assche
2023-04-10  8:32   ` Damien Le Moal
2023-04-10 17:31     ` Bart Van Assche

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=af4aeeea-79b2-8b0d-df8b-63f5ae6752d7@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=hch@lst.de \
    --cc=jaegeuk@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=snitzer@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.