* [PATCH 0/3] block: set ioprio value
@ 2019-07-10 4:02 Chaitanya Kulkarni
2019-07-10 4:02 ` [PATCH 1/3] block: set ioprio for zone-reset bio Chaitanya Kulkarni
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Chaitanya Kulkarni @ 2019-07-10 4:02 UTC (permalink / raw)
To: linux-block; +Cc: Chaitanya Kulkarni, axboe, hch
Hi,
While experimenting with the ionice, I came across the scenario where
I cannot see the bio/request priority field being set when using
blkdiscard for REQ_OP_DISCARD, REQ_OP_WRITE_ZEROES and other operations
like REQ_OP_WRITE_SAME, REQ_OP_ZONE_RESET, and flush.
This is a small patch-series which sets the ioprio value at various
places for the zone-reset, flush, write-zeroes and discard operations.
This patch series uses get_current_ioprio() so that bio associated
with the respective operation can inherit the value from current
process.
In order to test this, I've modified the null_blk and enabled the
write_zeroes through module param. Following are the results.
Without these patches:-
# modprobe null_blk gb=5 nr_devices=1 write_zeroes=1
# for prio in `seq 0 3`; do ionice -c ${prio} blkdiscard -z -o 0 -l 4096 /dev/nullb0; done
# dmesg -c
[ 402.958458] null_handle_cmd REQ_OP_WRITE_ZEROES priority class 0
[ 402.966024] null_handle_cmd REQ_OP_WRITE_ZEROES priority class 0
[ 402.973960] null_handle_cmd REQ_OP_WRITE_ZEROES priority class 0
[ 402.981373] null_handle_cmd REQ_OP_WRITE_ZEROES priority class 0
#
With these patches:-
# modprobe null_blk gb=5 nr_devices=1 write_zeroes=1
# for prio in `seq 0 3`; do ionice -c ${prio} blkdiscard -z -o 0 -l 4096 /dev/nullb0; done
# dmesg -c
[ 1426.091772] null_handle_cmd REQ_OP_WRITE_ZEROES priority class 0
[ 1426.100177] null_handle_cmd REQ_OP_WRITE_ZEROES priority class 1
[ 1426.108035] null_handle_cmd REQ_OP_WRITE_ZEROES priority class 2
[ 1426.115768] null_handle_cmd REQ_OP_WRITE_ZEROES priority class 3
#
With the block trace extension support is being worked on [1] which has
the ability to report the I/O priority, now we can track the correct
priority values with this patch-series.
Regards,
Chaitanya
[1] https://www.spinics.net/lists/linux-btrace/msg00880.html
Chaitanya Kulkarni (3):
block: set ioprio for zone-reset bio
block: set ioprio for flush bio
block: set ioprio for write-zeroes, discard etc
block/blk-flush.c | 2 ++
block/blk-lib.c | 6 ++++++
block/blk-zoned.c | 1 +
3 files changed, 9 insertions(+)
--
2.17.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] block: set ioprio for zone-reset bio
2019-07-10 4:02 [PATCH 0/3] block: set ioprio value Chaitanya Kulkarni
@ 2019-07-10 4:02 ` Chaitanya Kulkarni
2019-07-12 2:07 ` Martin K. Petersen
2019-07-10 4:02 ` [PATCH 2/3] block: set ioprio for flush bio Chaitanya Kulkarni
2019-07-10 4:02 ` [PATCH 3/3] block: set ioprio for write-zeroes, discard etc Chaitanya Kulkarni
2 siblings, 1 reply; 7+ messages in thread
From: Chaitanya Kulkarni @ 2019-07-10 4:02 UTC (permalink / raw)
To: linux-block; +Cc: Chaitanya Kulkarni, axboe, hch
Set the current process's iopriority to the bio for REQ_OP_ZONE_RESET.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
block/blk-zoned.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index ae7e91bd0618..0bd7981e9535 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -249,6 +249,7 @@ int blkdev_reset_zones(struct block_device *bdev,
bio->bi_iter.bi_sector = sector;
bio_set_dev(bio, bdev);
bio_set_op_attrs(bio, REQ_OP_ZONE_RESET, 0);
+ bio_set_prio(bio, get_current_ioprio());
sector += zone_sectors;
--
2.17.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] block: set ioprio for flush bio
2019-07-10 4:02 [PATCH 0/3] block: set ioprio value Chaitanya Kulkarni
2019-07-10 4:02 ` [PATCH 1/3] block: set ioprio for zone-reset bio Chaitanya Kulkarni
@ 2019-07-10 4:02 ` Chaitanya Kulkarni
2019-07-12 2:09 ` Martin K. Petersen
2019-07-10 4:02 ` [PATCH 3/3] block: set ioprio for write-zeroes, discard etc Chaitanya Kulkarni
2 siblings, 1 reply; 7+ messages in thread
From: Chaitanya Kulkarni @ 2019-07-10 4:02 UTC (permalink / raw)
To: linux-block; +Cc: Chaitanya Kulkarni, axboe, hch
Set the current process's iopriority for flush bio.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
block/blk-flush.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/block/blk-flush.c b/block/blk-flush.c
index aedd9320e605..21013fcdf42c 100644
--- a/block/blk-flush.c
+++ b/block/blk-flush.c
@@ -69,6 +69,7 @@
#include <linux/blkdev.h>
#include <linux/gfp.h>
#include <linux/blk-mq.h>
+#include <linux/ioprio.h>
#include "blk.h"
#include "blk-mq.h"
@@ -445,6 +446,7 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask,
bio = bio_alloc(gfp_mask, 0);
bio_set_dev(bio, bdev);
bio->bi_opf = REQ_OP_WRITE | REQ_PREFLUSH;
+ bio_set_prio(bio, get_current_ioprio());
ret = submit_bio_wait(bio);
--
2.17.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] block: set ioprio for write-zeroes, discard etc
2019-07-10 4:02 [PATCH 0/3] block: set ioprio value Chaitanya Kulkarni
2019-07-10 4:02 ` [PATCH 1/3] block: set ioprio for zone-reset bio Chaitanya Kulkarni
2019-07-10 4:02 ` [PATCH 2/3] block: set ioprio for flush bio Chaitanya Kulkarni
@ 2019-07-10 4:02 ` Chaitanya Kulkarni
2019-07-12 2:10 ` Martin K. Petersen
2 siblings, 1 reply; 7+ messages in thread
From: Chaitanya Kulkarni @ 2019-07-10 4:02 UTC (permalink / raw)
To: linux-block; +Cc: Chaitanya Kulkarni, axboe, hch
Set the current process's iopriority for discard, write-zeroes and
write-same operations.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
block/blk-lib.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/block/blk-lib.c b/block/blk-lib.c
index 5f2c429d4378..efc9a1bf5262 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -7,6 +7,7 @@
#include <linux/bio.h>
#include <linux/blkdev.h>
#include <linux/scatterlist.h>
+#include <linux/ioprio.h>
#include "blk.h"
@@ -64,6 +65,7 @@ int __blkdev_issue_discard(struct block_device *bdev, sector_t sector,
bio->bi_iter.bi_sector = sector;
bio_set_dev(bio, bdev);
bio_set_op_attrs(bio, op, 0);
+ bio_set_prio(bio, get_current_ioprio());
bio->bi_iter.bi_size = req_sects << 9;
sector += req_sects;
@@ -162,6 +164,7 @@ static int __blkdev_issue_write_same(struct block_device *bdev, sector_t sector,
bio->bi_io_vec->bv_offset = 0;
bio->bi_io_vec->bv_len = bdev_logical_block_size(bdev);
bio_set_op_attrs(bio, REQ_OP_WRITE_SAME, 0);
+ bio_set_prio(bio, get_current_ioprio());
if (nr_sects > max_write_same_sectors) {
bio->bi_iter.bi_size = max_write_same_sectors << 9;
@@ -234,6 +237,8 @@ static int __blkdev_issue_write_zeroes(struct block_device *bdev,
bio->bi_iter.bi_sector = sector;
bio_set_dev(bio, bdev);
bio->bi_opf = REQ_OP_WRITE_ZEROES;
+ bio_set_prio(bio, get_current_ioprio());
+
if (flags & BLKDEV_ZERO_NOUNMAP)
bio->bi_opf |= REQ_NOUNMAP;
@@ -286,6 +291,7 @@ static int __blkdev_issue_zero_pages(struct block_device *bdev,
bio->bi_iter.bi_sector = sector;
bio_set_dev(bio, bdev);
bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
+ bio_set_prio(bio, get_current_ioprio());
while (nr_sects != 0) {
sz = min((sector_t) PAGE_SIZE, nr_sects << 9);
--
2.17.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] block: set ioprio for zone-reset bio
2019-07-10 4:02 ` [PATCH 1/3] block: set ioprio for zone-reset bio Chaitanya Kulkarni
@ 2019-07-12 2:07 ` Martin K. Petersen
0 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2019-07-12 2:07 UTC (permalink / raw)
To: Chaitanya Kulkarni; +Cc: linux-block, axboe, hch
Chaitanya,
> Set the current process's iopriority to the bio for REQ_OP_ZONE_RESET.
Looks fine.
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] block: set ioprio for flush bio
2019-07-10 4:02 ` [PATCH 2/3] block: set ioprio for flush bio Chaitanya Kulkarni
@ 2019-07-12 2:09 ` Martin K. Petersen
0 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2019-07-12 2:09 UTC (permalink / raw)
To: Chaitanya Kulkarni; +Cc: linux-block, axboe, hch
Chaitanya,
> Set the current process's iopriority for flush bio.
Kind of weird for a flush command. But we might as well be consistent.
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] block: set ioprio for write-zeroes, discard etc
2019-07-10 4:02 ` [PATCH 3/3] block: set ioprio for write-zeroes, discard etc Chaitanya Kulkarni
@ 2019-07-12 2:10 ` Martin K. Petersen
0 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2019-07-12 2:10 UTC (permalink / raw)
To: Chaitanya Kulkarni; +Cc: linux-block, axboe, hch
Chaitanya,
> Set the current process's iopriority for discard, write-zeroes and
> write-same operations.
OK.
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-07-12 2:12 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-10 4:02 [PATCH 0/3] block: set ioprio value Chaitanya Kulkarni
2019-07-10 4:02 ` [PATCH 1/3] block: set ioprio for zone-reset bio Chaitanya Kulkarni
2019-07-12 2:07 ` Martin K. Petersen
2019-07-10 4:02 ` [PATCH 2/3] block: set ioprio for flush bio Chaitanya Kulkarni
2019-07-12 2:09 ` Martin K. Petersen
2019-07-10 4:02 ` [PATCH 3/3] block: set ioprio for write-zeroes, discard etc Chaitanya Kulkarni
2019-07-12 2:10 ` Martin K. Petersen
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.