public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: zhou xianrong <zhou_xianrong@yeah.net>
Cc: dm-devel@redhat.com, weimin.mao@transsion.com,
	haizhou.song@transsion.com, snitzer@redhat.com,
	wanbin.wang@transsion.com, xianrong.zhou@transsion.com,
	linux-kernel@vger.kernel.org, yuanjiong.gao@transsion.com,
	ruxian.feng@transsion.com, agk@redhat.com
Subject: Re: [PATCH] dm-verity: unnecessary data blocks that need not read hash blocks
Date: Fri, 13 Dec 2019 22:58:27 -0800	[thread overview]
Message-ID: <20191214065827.GA727@sol.localdomain> (raw)
In-Reply-To: <20191211033240.169-1-zhou_xianrong@yeah.net>

On Wed, Dec 11, 2019 at 11:32:40AM +0800, zhou xianrong wrote:
> From: "xianrong.zhou" <xianrong.zhou@transsion.com>
> 
> If check_at_most_once enabled, just like verity work the prefetching work
> should check for data block bitmap firstly before reading hash block
> as well. Skip bit-set data blocks from both ends of data block range
> by testing the validated bitmap. This can reduce the amounts of data 
> blocks which need to read hash blocks.
> 
> Launching 91 apps every 15s and repeat 21 rounds on Android Q.
> In prefetching work we can let only 2602/360312 = 0.72% data blocks
> really need to read hash blocks.
> 
> But the reduced data blocks range would be enlarged again by
> dm_verity_prefetch_cluster later.
> 
> Signed-off-by: xianrong.zhou <xianrong.zhou@transsion.com>
> Signed-off-by: yuanjiong.gao <yuanjiong.gao@transsion.com>
> Tested-by: ruxian.feng <ruxian.feng@transsion.com>
> ---
>  drivers/md/dm-verity-target.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
> index 4fb33e7562c5..7b8eb754c0b6 100644
> --- a/drivers/md/dm-verity-target.c
> +++ b/drivers/md/dm-verity-target.c
> @@ -581,6 +581,22 @@ static void verity_prefetch_io(struct work_struct *work)
>  	struct dm_verity *v = pw->v;
>  	int i;
>  
> +	if (v->validated_blocks) {
> +		while (pw->n_blocks) {
> +			if (unlikely(!test_bit(pw->block, v->validated_blocks)))
> +				break;
> +			pw->block++;
> +			pw->n_blocks--;
> +		}
> +		while (pw->n_blocks) {
> +			if (unlikely(!test_bit(pw->block + pw->n_blocks - 1,
> +				v->validated_blocks)))
> +				break;
> +			pw->n_blocks--;
> +		}
> +		if (!pw->n_blocks)
> +			return;
> +	}

This is a good idea, but shouldn't this logic go in verity_submit_prefetch()
prior to the struct dm_verity_prefetch_work being allocated?  Then if no
prefeching is needed, allocating and scheduling the work object can be skipped.

Also note that you're currently leaking the work object with the early return.

- Eric

       reply	other threads:[~2019-12-14  6:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20191211033240.169-1-zhou_xianrong@yeah.net>
2019-12-14  6:58 ` Eric Biggers [this message]
2019-12-16  2:02 Reply [PATCH] dm-verity: unnecessary data blocks that need not read hash blocks xianrong.zhou(周先荣)
2019-12-16 18:50 ` Eric Biggers
     [not found] <20200107024843.8660-1-zhou_xianrong@sohu.com>
2020-01-07  3:14 ` [PATCH] dm-verity:unnecessary " Eric Biggers

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=20191214065827.GA727@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=haizhou.song@transsion.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ruxian.feng@transsion.com \
    --cc=snitzer@redhat.com \
    --cc=wanbin.wang@transsion.com \
    --cc=weimin.mao@transsion.com \
    --cc=xianrong.zhou@transsion.com \
    --cc=yuanjiong.gao@transsion.com \
    --cc=zhou_xianrong@yeah.net \
    /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