All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mikulas Patocka <mpatocka@redhat.com>
To: LongPing Wei <weilongping@oppo.com>
Cc: snitzer@kernel.org, dm-devel@lists.linux.dev,
	guoweichao@oppo.com,  ebiggers@kernel.org, bvanassche@acm.org
Subject: Re: [PATCH 2/2] dm-verity: prefetch all hash blocks in verity_ctr
Date: Wed, 2 Apr 2025 11:56:51 +0200 (CEST)	[thread overview]
Message-ID: <8ec81db3-fff0-71be-e643-b74cb5bb88de@redhat.com> (raw)
In-Reply-To: <20250402070934.2387587-2-weilongping@oppo.com>



On Wed, 2 Apr 2025, LongPing Wei wrote:

> At this time, all bios for hash blocks should eventually
> be merged into a single large bio.
> 
> Signed-off-by: LongPing Wei <weilongping@oppo.com>
> ---
>  drivers/md/dm-verity-target.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
> index 3c427f18a04b..813d5cfc7ffa 100644
> --- a/drivers/md/dm-verity-target.c
> +++ b/drivers/md/dm-verity-target.c
> @@ -1683,6 +1683,10 @@ static int verity_ctr(struct dm_target *ti, unsigned int argc, char **argv)
>  
>  	verity_verify_sig_opts_cleanup(&verify_args);
>  
> +	dm_bufio_prefetch_with_ioprio(v->bufio, v->hash_start,
> +		v->hash_blocks - v->hash_start,
> +		IOPRIO_PRIO_VALUE(IOPRIO_CLASS_RT, 0));
> +
>  	dm_audit_log_ctr(DM_MSG_PREFIX, ti, 1);
>  
>  	return 0;
> -- 
> 2.34.1

Hi

I would move it into the "resume" callback, so that if the user 
reconfigures the device stack between "ctr" and "resume", it won't read 
the data too early.

Don't use IOPRIO_CLASS_RT, this is not real-time requirement, 
IOPRIO_CLASS_RT would slow down concurrent I/O.

Another problem with this approach is that when the verity device is big 
and system memory is small, it just causes I/O churn - new bufio blocks 
will be displacing old blocks - and it will degrade performance, not 
improve it.

Please, describe some scenario, where this prefetch actually helps. What 
is the size of the metadata that you are prefetching? What is the total 
memory size? Is there any benchmark that shows the advantage of this 
patch?

Mikulas


  reply	other threads:[~2025-04-02  9:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-02  7:09 [PATCH 1/2] dm-bufio: improve the performance of __dm_bufio_prefetch LongPing Wei
2025-04-02  7:09 ` [PATCH 2/2] dm-verity: prefetch all hash blocks in verity_ctr LongPing Wei
2025-04-02  9:56   ` Mikulas Patocka [this message]
2025-04-02 10:35     ` LongPing Wei
2025-04-02 18:44       ` Mikulas Patocka
2025-04-02 23:58         ` LongPing Wei
2025-04-10  8:28         ` Christoph Hellwig
2025-04-10  8:26   ` Christoph Hellwig
2025-04-02 17:43 ` [PATCH 1/2] dm-bufio: improve the performance of __dm_bufio_prefetch Eric Biggers
2025-04-03  0:12   ` LongPing Wei
2025-04-10  8:29 ` Christoph Hellwig

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=8ec81db3-fff0-71be-e643-b74cb5bb88de@redhat.com \
    --to=mpatocka@redhat.com \
    --cc=bvanassche@acm.org \
    --cc=dm-devel@lists.linux.dev \
    --cc=ebiggers@kernel.org \
    --cc=guoweichao@oppo.com \
    --cc=snitzer@kernel.org \
    --cc=weilongping@oppo.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 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.