linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: sj@kernel.org
To: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Cc: sj@kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] damon: vaddr-test: tweak code to make the logic clearer
Date: Mon, 28 Mar 2022 11:42:51 +0000	[thread overview]
Message-ID: <20220328114251.31851-1-sj@kernel.org> (raw)
In-Reply-To: <20220328112930.31229-1-xiam0nd.tong@gmail.com>

On Mon, 28 Mar 2022 19:29:30 +0800 Xiaomeng Tong <xiam0nd.tong@gmail.com> wrote:

> Move these two lines into the damon_for_each_region loop, it is always
> for testing the last region. And also avoid to use a list iterator 'r'
> outside the loop which is considered harmful[1].
> 
> [1]:  https://lkml.org/lkml/2022/2/17/1032

Let's have one empty line here[1].

[1] https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html#the-canonical-patch-format

> Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>

Other than the above trivial nit,

Reviewed-by: SeongJae Park <sj@kernel.org>


Thanks,
SJ

> ---
>  mm/damon/vaddr-test.h | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/damon/vaddr-test.h b/mm/damon/vaddr-test.h
> index 6a1b9272ea12..98b7a9f54b35 100644
> --- a/mm/damon/vaddr-test.h
> +++ b/mm/damon/vaddr-test.h
> @@ -281,14 +281,16 @@ static void damon_test_split_evenly_succ(struct kunit *test,
>  	KUNIT_EXPECT_EQ(test, damon_nr_regions(t), nr_pieces);
>  
>  	damon_for_each_region(r, t) {
> -		if (i == nr_pieces - 1)
> +		if (i == nr_pieces - 1) {
> +			KUNIT_EXPECT_EQ(test,
> +				r->ar.start, start + i * expected_width);
> +			KUNIT_EXPECT_EQ(test, r->ar.end, end);
>  			break;
> +		}
>  		KUNIT_EXPECT_EQ(test,
>  				r->ar.start, start + i++ * expected_width);
>  		KUNIT_EXPECT_EQ(test, r->ar.end, start + i * expected_width);
>  	}
> -	KUNIT_EXPECT_EQ(test, r->ar.start, start + i * expected_width);
> -	KUNIT_EXPECT_EQ(test, r->ar.end, end);
>  	damon_free_target(t);
>  }
>  
> -- 
> 2.17.1


  reply	other threads:[~2022-03-28 11:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-28 11:29 Xiaomeng Tong
2022-03-28 11:42 ` sj [this message]
2022-03-28 11:52 Xiaomeng Tong

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=20220328114251.31851-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=xiam0nd.tong@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