public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: Jianchao Wang <jianchao.w.wang@oracle.com>
Cc: axboe@kernel.dk, holger@applied-asynchrony.com,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2 1/2] blk-mq: abstract out blk-mq-sched rq list iteration bio merge helper
Date: Tue, 29 May 2018 11:55:41 -0700	[thread overview]
Message-ID: <20180529185541.GB23487@vader> (raw)
In-Reply-To: <1527057202-2802-2-git-send-email-jianchao.w.wang@oracle.com>

On Wed, May 23, 2018 at 02:33:21PM +0800, Jianchao Wang wrote:
> From: Jens Axboe <axboe@kernel.dk>
> 
> No functional changes in this patch, just a prep patch for utilizing
> this in an IO scheduler.

Reviewed-by: Omar Sandoval <osandov@fb.com>

> Signed-off-by: Jens Axboe <axboe@kernel.dk>
> ---
>  block/blk-mq-sched.c   | 34 ++++++++++++++++++++++++----------
>  include/linux/blk-mq.h |  3 ++-
>  2 files changed, 26 insertions(+), 11 deletions(-)
> 
> diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
> index 25c14c5..b0f2c2a 100644
> --- a/block/blk-mq-sched.c
> +++ b/block/blk-mq-sched.c
> @@ -268,19 +268,16 @@ bool blk_mq_sched_try_merge(struct request_queue *q, struct bio *bio,
>  EXPORT_SYMBOL_GPL(blk_mq_sched_try_merge);
>  
>  /*
> - * Reverse check our software queue for entries that we could potentially
> - * merge with. Currently includes a hand-wavy stop count of 8, to not spend
> - * too much time checking for merges.
> + * Iterate list of requests and see if we can merge this bio with any
> + * of them.
>   */
> -static bool blk_mq_attempt_merge(struct request_queue *q,
> -				 struct blk_mq_ctx *ctx, struct bio *bio)
> +bool blk_mq_bio_list_merge(struct request_queue *q, struct list_head *list,
> +			   struct bio *bio)
>  {
>  	struct request *rq;
>  	int checked = 8;
>  
> -	lockdep_assert_held(&ctx->lock);
> -
> -	list_for_each_entry_reverse(rq, &ctx->rq_list, queuelist) {
> +	list_for_each_entry_reverse(rq, list, queuelist) {
>  		bool merged = false;
>  
>  		if (!checked--)
> @@ -305,13 +302,30 @@ static bool blk_mq_attempt_merge(struct request_queue *q,
>  			continue;
>  		}
>  
> -		if (merged)
> -			ctx->rq_merged++;
>  		return merged;
>  	}
>  
>  	return false;
>  }
> +EXPORT_SYMBOL_GPL(blk_mq_bio_list_merge);
> +
> +/*
> + * Reverse check our software queue for entries that we could potentially
> + * merge with. Currently includes a hand-wavy stop count of 8, to not spend
> + * too much time checking for merges.
> + */
> +static bool blk_mq_attempt_merge(struct request_queue *q,
> +				 struct blk_mq_ctx *ctx, struct bio *bio)
> +{
> +	lockdep_assert_held(&ctx->lock);
> +
> +	if (blk_mq_bio_list_merge(q, &ctx->rq_list, bio)) {
> +		ctx->rq_merged++;
> +		return true;
> +	}
> +
> +	return false;
> +}
>  
>  bool __blk_mq_sched_bio_merge(struct request_queue *q, struct bio *bio)
>  {
> diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
> index ebc34a5..fb35517 100644
> --- a/include/linux/blk-mq.h
> +++ b/include/linux/blk-mq.h
> @@ -259,7 +259,8 @@ void blk_mq_add_to_requeue_list(struct request *rq, bool at_head,
>  void blk_mq_kick_requeue_list(struct request_queue *q);
>  void blk_mq_delay_kick_requeue_list(struct request_queue *q, unsigned long msecs);
>  void blk_mq_complete_request(struct request *rq);
> -
> +bool blk_mq_bio_list_merge(struct request_queue *q, struct list_head *list,
> +			   struct bio *bio);
>  bool blk_mq_queue_stopped(struct request_queue *q);
>  void blk_mq_stop_hw_queue(struct blk_mq_hw_ctx *hctx);
>  void blk_mq_start_hw_queue(struct blk_mq_hw_ctx *hctx);
> -- 
> 2.7.4
> 

  reply	other threads:[~2018-05-29 18:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-23  6:33 [PATCH V2 0/2] block: kyber: make kyber more friendly with merging Jianchao Wang
2018-05-23  6:33 ` [PATCH V2 1/2] blk-mq: abstract out blk-mq-sched rq list iteration bio merge helper Jianchao Wang
2018-05-29 18:55   ` Omar Sandoval [this message]
2018-05-23  6:33 ` [PATCH V2 2/2] block: kyber: make kyber more friendly with merging Jianchao Wang
2018-05-29 18:55   ` Omar Sandoval
2018-05-30  3:10     ` jianchao.wang

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=20180529185541.GB23487@vader \
    --to=osandov@osandov.com \
    --cc=axboe@kernel.dk \
    --cc=holger@applied-asynchrony.com \
    --cc=jianchao.w.wang@oracle.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox