[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231220100333.107049-2-hongyu.jin.cn@gmail.com>
Date: Wed, 20 Dec 2023 18:03:29 +0800
From: Hongyu Jin <hongyu.jin.cn@...il.com>
To: agk@...hat.com,
snitzer@...nel.org,
mpatocka@...hat.com,
axboe@...nel.dk,
ebiggers@...nel.org
Cc: zhiguo.niu@...soc.com,
ke.wang@...soc.com,
yibin.ding@...soc.com,
hongyu.jin@...soc.com,
linux-kernel@...r.kernel.org,
dm-devel@...ts.linux.dev,
linux-block@...r.kernel.org
Subject: [PATCH v6 1/5] block: Fix bio IO priority setting
From: Hongyu Jin <hongyu.jin@...soc.com>
Move bio_set_ioprio() into submit_bio():
1. Only call bio_set_ioprio() once to set the priority of original bio,
the bio that cloned and splited from original bio will auto inherit
the priority of original bio in clone process.
2. The IO priority can be passed to module that implement
struct gendisk::fops::submit_bio, help resolve some
of the IO priority loss issues.
This patch depends on commit 82b74cac2849 ("blk-ioprio: Convert from
rqos policy to direct call")
Fixes: a78418e6a04c ("block: Always initialize bio IO priority on submit")
Co-developed-by: Yibin Ding <yibin.ding@...soc.com>
Signed-off-by: Yibin Ding <yibin.ding@...soc.com>
Signed-off-by: Hongyu Jin <hongyu.jin@...soc.com>
---
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 2eca76ccf4ee..d707ec056f34 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;
@@ -817,6 +818,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
@@ -839,6 +848,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 ac18f802c027..351e8283eda1 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);
@@ -2919,14 +2918,6 @@ static bool blk_mq_can_use_cached_rq(struct request *rq, struct blk_plug *plug,
return true;
}
-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.
@@ -2957,8 +2948,6 @@ void blk_mq_submit_bio(struct bio *bio)
return;
}
- bio_set_ioprio(bio);
-
if (plug) {
rq = rq_list_peek(&plug->cached_rq);
if (rq && rq->q != q)
--
2.34.1
Powered by blists - more mailing lists