linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@kernel.org>
To: Hongyu Jin <hongyu.jin.cn@gmail.com>, Jan Kara <jack@suse.cz>
Cc: agk@redhat.com, mpatocka@redhat.com, axboe@kernel.dk,
	ebiggers@kernel.org, zhiguo.niu@unisoc.com, ke.wang@unisoc.com,
	yibin.ding@unisoc.com, hongyu.jin@unisoc.com,
	linux-kernel@vger.kernel.org, dm-devel@lists.linux.dev,
	linux-block@vger.kernel.org
Subject: Re: [PATCH v3 1/5] block: Optimize bio io priority setting
Date: Mon, 11 Dec 2023 16:12:43 -0500	[thread overview]
Message-ID: <ZXd7S9V8SQ3HSEbJ@redhat.com> (raw)
In-Reply-To: <20231211090000.9578-2-hongyu.jin.cn@gmail.com>

On Mon, Dec 11 2023 at  3:59P -0500,
Hongyu Jin <hongyu.jin.cn@gmail.com> wrote:

> From: Hongyu Jin <hongyu.jin@unisoc.com>
> 
> Current call bio_set_ioprio() for each cloned bio and splited bio,
> and the io priority can't be passed to module that implement
> struct gendisk::fops::submit_bio, such as device-mapper.
> 
> Move bio_set_ioprio() into submit_bio(), only call bio_set_ioprio()
> once set the priority of origin bio, cloned and splited bio
> auto inherit the priority of origin bio in clone process.
> 
> Co-developed-by: Yibin Ding <yibin.ding@unisoc.com>
> Signed-off-by: Yibin Ding <yibin.ding@unisoc.com>
> Signed-off-by: Hongyu Jin <hongyu.jin@unisoc.com>

This patch's subject needs fixing (this is a fix, not an optimization)
and the header needs fixing (various issues that make it hard to
read).

This should also be tagged with:
Fixes: a78418e6a04c9 ("block: Always initialize bio IO priority on submit")

(commit 82b74cac28493 was commit immediately prior that placed the
direct call incorrectly)

Reviewed-by: Mike Snitzer <snitzer@kernel.org>

> ---
>  block/blk-core.c | 10 ++++++++++
>  block/blk-mq.c   | 11 -----------
>  2 files changed, 10 insertions(+), 11 deletions(-)
> 
> diff --git a/block/blk-core.c b/block/blk-core.c
> index fdf25b8d6e78..68158c327aea 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -49,6 +49,7 @@
>  #include "blk-pm.h"
>  #include "blk-cgroup.h"
>  #include "blk-throttle.h"
> +#include "blk-ioprio.h"
>  
>  struct dentry *blk_debugfs_root;
>  
> @@ -809,6 +810,14 @@ void submit_bio_noacct(struct bio *bio)
>  }
>  EXPORT_SYMBOL(submit_bio_noacct);
>  
> +static void bio_set_ioprio(struct bio *bio)
> +{
> +	/* Nobody set ioprio so far? Initialize it based on task's nice value */
> +	if (IOPRIO_PRIO_CLASS(bio->bi_ioprio) == IOPRIO_CLASS_NONE)
> +		bio->bi_ioprio = get_current_ioprio();
> +	blkcg_set_ioprio(bio);
> +}
> +
>  /**
>   * submit_bio - submit a bio to the block device layer for I/O
>   * @bio: The &struct bio which describes the I/O
> @@ -831,6 +840,7 @@ void submit_bio(struct bio *bio)
>  		count_vm_events(PGPGOUT, bio_sectors(bio));
>  	}
>  
> +	bio_set_ioprio(bio);
>  	submit_bio_noacct(bio);
>  }
>  EXPORT_SYMBOL(submit_bio);
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index e2d11183f62e..a6e2609df9c9 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -40,7 +40,6 @@
>  #include "blk-stat.h"
>  #include "blk-mq-sched.h"
>  #include "blk-rq-qos.h"
> -#include "blk-ioprio.h"
>  
>  static DEFINE_PER_CPU(struct llist_head, blk_cpu_done);
>  static DEFINE_PER_CPU(call_single_data_t, blk_cpu_csd);
> @@ -2922,14 +2921,6 @@ static inline struct request *blk_mq_get_cached_request(struct request_queue *q,
>  	return rq;
>  }
>  
> -static void bio_set_ioprio(struct bio *bio)
> -{
> -	/* Nobody set ioprio so far? Initialize it based on task's nice value */
> -	if (IOPRIO_PRIO_CLASS(bio->bi_ioprio) == IOPRIO_CLASS_NONE)
> -		bio->bi_ioprio = get_current_ioprio();
> -	blkcg_set_ioprio(bio);
> -}
> -
>  /**
>   * blk_mq_submit_bio - Create and send a request to block device.
>   * @bio: Bio pointer.
> @@ -2963,8 +2954,6 @@ void blk_mq_submit_bio(struct bio *bio)
>  	if (!bio_integrity_prep(bio))
>  		return;
>  
> -	bio_set_ioprio(bio);
> -
>  	rq = blk_mq_get_cached_request(q, plug, &bio, nr_segs);
>  	if (!rq) {
>  		if (!bio)
> -- 
> 2.34.1
> 
> 

  reply	other threads:[~2023-12-11 21:12 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-28  9:44 [PATCH] dm: increase the io priority of the kworker-kverityd process Yunlong Xing
2023-11-28 14:07 ` Mikulas Patocka
2023-12-06 11:39   ` [PATCH v2] dm verity: Inherit I/O priority from data I/O when read FEC and hash from disk Hongyu Jin
2023-12-08  1:54     ` Eric Biggers
2023-12-08 20:34       ` Eric Wheeler
2023-12-11  8:59         ` [PATCH v3 0/5] Fix I/O priority lost in device-mapper Hongyu Jin
2023-12-11  8:59           ` [PATCH v3 1/5] block: Optimize bio io priority setting Hongyu Jin
2023-12-11 21:12             ` Mike Snitzer [this message]
2023-12-11  8:59           ` [PATCH v3 2/5] dm: Support I/O priority for dm_io() Hongyu Jin
2023-12-11  8:59           ` [PATCH v3 3/5] dm-bufio: Support I/O priority Hongyu Jin
2023-12-11  8:59           ` [PATCH v3 4/5] dm verity: Fix I/O priority lost when read FEC and hash Hongyu Jin
2023-12-11  9:00           ` [PATCH v3 5/5] dm-crypt: Fix lost ioprio when queuing write bios Hongyu Jin
2023-12-11 20:32             ` Eric Wheeler
2023-12-11 22:15             ` Mike Snitzer
2023-12-12 11:11               ` [PATCH v4 0/5] Fix I/O priority lost in device-mapper Hongyu Jin
2023-12-12 11:11                 ` [PATCH v4 1/5] block: Fix bio IO priority setting Hongyu Jin
2023-12-12 13:13                   ` Christoph Hellwig
2023-12-12 18:02                     ` Mike Snitzer
2023-12-12 11:11                 ` [PATCH v4 2/5] dm: Support I/O priority for dm_io() Hongyu Jin
2023-12-13  4:57                   ` Eric Biggers
2023-12-12 11:11                 ` [PATCH v4 3/5] dm-bufio: Support I/O priority Hongyu Jin
2023-12-13  5:00                   ` Eric Biggers
2023-12-12 11:11                 ` [PATCH v4 4/5] dm verity: Fix I/O priority lost when read FEC and hash Hongyu Jin
2023-12-12 11:11                 ` [PATCH v4 5/5] dm-crypt: Fix lost ioprio when queuing write bios Hongyu Jin
2023-12-13  4:45                 ` [PATCH v4 0/5] Fix I/O priority lost in device-mapper Eric Biggers
2023-12-13  9:24                   ` Henry King
2023-12-13 10:42                     ` Hongyu Jin
2023-12-13 10:42                       ` [PATCH v5 1/5] block: Fix bio IO priority setting Hongyu Jin
2023-12-13 16:58                         ` Mike Snitzer
2023-12-18  1:24                           ` Henry King
2023-12-18  1:27                             ` [PATCH v5 RESEND 0/5] Fix I/O priority lost in device-mapper Hongyu Jin
2023-12-18  1:27                               ` [PATCH v5 RESEND 1/5] block: Fix bio IO priority setting Hongyu Jin
2023-12-18  1:27                               ` [PATCH v5 RESEND 2/5] dm: Support I/O priority for dm_io() Hongyu Jin
2023-12-19 22:46                                 ` Eric Biggers
2023-12-18  1:27                               ` [PATCH v5 RESEND 3/5] dm-bufio: Support I/O priority Hongyu Jin
2023-12-19 22:46                                 ` Eric Biggers
2023-12-18  1:27                               ` [PATCH v5 RESEND 4/5] dm verity: Fix I/O priority lost when read FEC and hash Hongyu Jin
2023-12-19 22:48                                 ` Eric Biggers
2023-12-20  1:14                                   ` Hongyu Jin
2023-12-18  1:27                               ` [PATCH v5 RESEND 5/5] dm-crypt: Fix lost ioprio when queuing write bios Hongyu Jin
2023-12-19 22:50                                 ` Eric Biggers
2023-12-19  0:46                               ` [PATCH v5 RESEND 0/5] Fix I/O priority lost in device-mapper Eric Biggers
2023-12-13 10:42                       ` [PATCH v5 2/5] dm: Support I/O priority for dm_io() Hongyu Jin
2023-12-13 10:42                       ` [PATCH v5 3/5] dm-bufio: Support I/O priority Hongyu Jin
2023-12-13 10:42                       ` [PATCH v5 4/5] dm verity: Fix I/O priority lost when read FEC and hash Hongyu Jin
2023-12-13 10:42                       ` [PATCH v5 5/5] dm-crypt: Fix lost ioprio when queuing write bios Hongyu Jin
2023-12-20 10:03                         ` [PATCH v6 0/5] Fix I/O priority lost in device-mapper Hongyu Jin
2023-12-20 10:03                           ` [PATCH v6 1/5] block: Fix bio IO priority setting Hongyu Jin
2023-12-20 10:03                           ` [PATCH v6 2/5] dm: Support I/O priority for dm_io() Hongyu Jin
2023-12-20 10:03                           ` [PATCH v6 3/5] dm-bufio: Support I/O priority Hongyu Jin
2023-12-20 10:03                           ` [PATCH v6 4/5] dm verity: Fix I/O priority lost when read FEC and hash Hongyu Jin
2023-12-20 18:32                             ` Eric Biggers
2023-12-20 10:03                           ` [PATCH v6 5/5] dm-crypt: Fix lost ioprio when queuing write bios Hongyu Jin
2023-12-21 10:31                             ` [PATCH v7 0/5] Fix I/O priority lost in device-mapper Hongyu Jin
2023-12-21 10:31                               ` [PATCH v7 1/5] block: Fix bio IO priority setting Hongyu Jin
2023-12-21 10:31                               ` [PATCH v7 2/5] dm: Support I/O priority for dm_io() Hongyu Jin
2023-12-21 10:31                               ` [PATCH v7 3/5] dm-bufio: Support I/O priority Hongyu Jin
2023-12-21 10:31                               ` [PATCH v7 4/5] dm verity: Fix I/O priority lost when read FEC and hash Hongyu Jin
2023-12-21 10:31                               ` [PATCH v7 5/5] dm-crypt: Fix lost ioprio when queuing write bios Hongyu Jin
2024-01-24  5:35                                 ` [PATCH v8 0/5] Fix I/O priority lost in device-mapper Hongyu Jin
2024-01-24  5:35                                   ` [PATCH v8 1/5] block: Fix bio IO priority setting Hongyu Jin
2024-01-24  5:35                                   ` [PATCH v8 2/5] dm: Support I/O priority for dm_io() Hongyu Jin
2024-01-24  5:35                                   ` [PATCH v8 3/5] dm-bufio: Support I/O priority Hongyu Jin
2024-01-24  5:35                                   ` [PATCH v8 4/5] dm verity: Fix I/O priority lost when read FEC and hash Hongyu Jin
2024-01-24  5:35                                   ` [PATCH v8 5/5] dm-crypt: Fix lost ioprio when queuing write bios Hongyu Jin
2024-01-29 16:30                                   ` [PATCH v8 0/5] Fix I/O priority lost in device-mapper Mike Snitzer
2024-01-29 19:29                                   ` Mikulas Patocka
2023-12-23 15:41                               ` [PATCH v7 " Eric Biggers

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=ZXd7S9V8SQ3HSEbJ@redhat.com \
    --to=snitzer@kernel.org \
    --cc=agk@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=dm-devel@lists.linux.dev \
    --cc=ebiggers@kernel.org \
    --cc=hongyu.jin.cn@gmail.com \
    --cc=hongyu.jin@unisoc.com \
    --cc=jack@suse.cz \
    --cc=ke.wang@unisoc.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=yibin.ding@unisoc.com \
    --cc=zhiguo.niu@unisoc.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;
as well as URLs for NNTP newsgroup(s).