mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yi Sun <yi.sun@unisoc.com>
To: <sunyibuaa@gmail.com>, <tj@kernel.org>, <jaegeuk@kernel.org>,
	<chao@kernel.org>
Cc: <ebiggers@google.com>, <jiangshanlai@gmail.com>,
	<kent.overstreet@linux.dev>, <linux-kernel@vger.kernel.org>,
	<linux-f2fs-devel@lists.sourceforge.net>, <niuzhiguo84@gmail.com>,
	<Hao_hao.Wang@unisoc.com>, <yunlongxing23@gmail.com>
Subject: [PATCH 2/2] f2fs: set f2fs verify work io priority
Date: Fri, 21 Jun 2024 14:26:17 +0800	[thread overview]
Message-ID: <20240621062617.595007-3-yi.sun@unisoc.com> (raw)
In-Reply-To: <20240621062617.595007-1-yi.sun@unisoc.com>

The io priority of reading the original data of the verity-file
and reading hash blocks during verification should be consistent.
If the io priority is not set, when a high-task-priority process
reads the verity-file, the kworker's io priority may be too low,
resulting in delayed reading of hash blocks, which eventually
causes the high-task-priority process to response slowly.

Signed-off-by: Yi Sun <yi.sun@unisoc.com>
---
 fs/f2fs/data.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index b9b0debc6b3d..705a2bdf0848 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -172,6 +172,8 @@ static void f2fs_verify_bio(struct work_struct *work)
 	struct bio *bio = ctx->bio;
 	bool may_have_compressed_pages = (ctx->enabled_steps & STEP_DECOMPRESS);
 
+	may_adjust_work_task_ioprio(work);
+
 	/*
 	 * fsverity_verify_bio() may call readahead() again, and while verity
 	 * will be disabled for this, decryption and/or decompression may still
@@ -204,6 +206,8 @@ static void f2fs_verify_bio(struct work_struct *work)
 	}
 
 	f2fs_finish_read_bio(bio, true);
+
+	restore_work_task_ioprio(work);
 }
 
 /*
@@ -221,6 +225,7 @@ static void f2fs_verify_and_finish_bio(struct bio *bio, bool in_task)
 
 	if (ctx && (ctx->enabled_steps & STEP_VERITY)) {
 		INIT_WORK(&ctx->work, f2fs_verify_bio);
+		set_work_ioprio(&ctx->work, bio->bi_ioprio);
 		fsverity_enqueue_verify_work(&ctx->work);
 	} else {
 		f2fs_finish_read_bio(bio, in_task);
-- 
2.25.1


      parent reply	other threads:[~2024-06-21  6:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-21  6:26 [PATCH 0/2] add io priority feature to work and use it in f2fs fsverity work Yi Sun
2024-06-21  6:26 ` [PATCH 1/2] workqueue: add io priority to work_struct Yi Sun
2024-06-21  8:00   ` Lai Jiangshan
2024-06-21 14:23   ` Kent Overstreet
2024-06-26  4:32   ` kernel test robot
2024-06-26  5:17   ` kernel test robot
2024-06-21  6:26 ` Yi Sun [this message]

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=20240621062617.595007-3-yi.sun@unisoc.com \
    --to=yi.sun@unisoc.com \
    --cc=Hao_hao.Wang@unisoc.com \
    --cc=chao@kernel.org \
    --cc=ebiggers@google.com \
    --cc=jaegeuk@kernel.org \
    --cc=jiangshanlai@gmail.com \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=niuzhiguo84@gmail.com \
    --cc=sunyibuaa@gmail.com \
    --cc=tj@kernel.org \
    --cc=yunlongxing23@gmail.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

all inboxes | Powered by JetHome®