Re: [PATCH] dm: increase the io priority of the kworker-kverityd process

From: Mikulas Patocka
Date: Tue Nov 28 2023 - 09:07:41 EST


Hi

This isn't correct - the workqueue process is reused by multiple work
items - from dm-verity as well as from other subsystems - so you would be
unexpectedly boosting priority of other tasks.

The correct solution would be to set the ioprio field of the outcoming
bios in dm-bufio explicitely.

Mikulas


On Tue, 28 Nov 2023, Yunlong Xing wrote:

> From: Hongyu Jin <hongyu.jin@xxxxxxxxxx>
>
> When obtaining the hash value of a high IO priority data block
> from the disk, the kverity-worker that obtains the hash will
> also have a high IO priority to avoid being blocked by other
> IO with low IO priority.
>
> Signed-off-by: Hongyu Jin <hongyu.jin@xxxxxxxxxx>
> Signed-off-by: Yibin Ding <yibin.ding@xxxxxxxxxx>
> ---
> drivers/md/dm-verity-target.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
> index e115fcfe723c..ade9c6734154 100644
> --- a/drivers/md/dm-verity-target.c
> +++ b/drivers/md/dm-verity-target.c
> @@ -22,6 +22,7 @@
> #include <linux/scatterlist.h>
> #include <linux/string.h>
> #include <linux/jump_label.h>
> +#include <linux/ioprio.h>
>
> #define DM_MSG_PREFIX "verity"
>
> @@ -639,7 +640,9 @@ static void verity_finish_io(struct dm_verity_io *io, blk_status_t status)
> static void verity_work(struct work_struct *w)
> {
> struct dm_verity_io *io = container_of(w, struct dm_verity_io, work);
> + struct bio *bio = dm_bio_from_per_bio_data(io, io->v->ti->per_io_data_size);
>
> + set_task_ioprio(current, bio->bi_ioprio);
> io->in_tasklet = false;
>
> verity_fec_init_io(io);
> --
> 2.25.1
>
>