lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251224153125.69194-1-sj@kernel.org>
Date: Wed, 24 Dec 2025 07:31:23 -0800
From: SeongJae Park <sj@...nel.org>
To: SeongJae Park <sj@...nel.org>
Cc: Shu Anzai <shu17az@...il.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	damon@...ts.linux.dev,
	linux-mm@...ck.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 4/5] mm/damon/tests/core-kunit: add test cases for multiple regions in damon_test_split_regions_of()

On Tue, 23 Dec 2025 21:34:06 -0800 SeongJae Park <sj@...nel.org> wrote:

> On Wed, 24 Dec 2025 04:21:59 +0000 Shu Anzai <shu17az@...il.com> wrote:
> 
> > Extend damon_test_split_regions_of() to verify that it correctly handles 
> > multiple regions with various 'min_sz_region'.
> > 
> > Signed-off-by: Shu Anzai <shu17az@...il.com>
> > ---
> >  mm/damon/tests/core-kunit.h | 21 +++++++++++++++++++++
> >  1 file changed, 21 insertions(+)
> > 
> > diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h
> > index 2eb6f41635a8..36622a2c11f1 100644
> > --- a/mm/damon/tests/core-kunit.h
> > +++ b/mm/damon/tests/core-kunit.h
> > @@ -275,6 +275,9 @@ static void damon_test_split_regions_of(struct kunit *test)
> >  {
> >  	struct damon_target *t;
> >  	struct damon_region *r;
> > +	unsigned long sa[] = {0, 300, 500};
> > +	unsigned long ea[] = {220, 400, 700};
> > +	int i;
> >  
> >  	t = damon_new_target();
> >  	if (!t)
> > @@ -301,6 +304,24 @@ static void damon_test_split_regions_of(struct kunit *test)
> >  	damon_split_regions_of(t, 4, 1);
> >  	KUNIT_EXPECT_LE(test, damon_nr_regions(t), 4u);
> >  	damon_free_target(t);
> > +
> > +	t = damon_new_target();
> > +	if (!t)
> > +		kunit_skip(test, "third target alloc fail");
> > +	for (i = 0; i < ARRAY_SIZE(sa); i++) {
> > +		r = damon_new_region(sa[i], ea[i]);
> > +		if (!r) {
> > +			damon_free_target(t);
> > +			kunit_skip(test, "region alloc fail");
> > +		}
> > +		damon_add_region(r, t);
> > +	}
> > +	damon_split_regions_of(t, 4, 5);
> > +	KUNIT_EXPECT_LE(test, damon_nr_regions(t), 12u);
> > +	damon_for_each_region(r, t) {
> > +		KUNIT_EXPECT_GE(test, damon_sz_region(r) % 5ul, 0ul);
> > +	}
> 
> Nit.  The above braces for single statement is unnecessary.

Andrew, could you please pick this series with below attaching fixup for this
one?

> 
> > +	damon_free_target(t);
> >  }
> >  
> >  static void damon_test_ops_registration(struct kunit *test)
> > -- 
> > 2.43.0
> 
> Other than the above trivial nit for the unnecessary braces,
> 
> Reviewed-by: SeongJae Park <sj@...nel.org>
> 
> 
> Thanks,
> SJ


Thanks,
SJ

==== >8 ====
>From dde3e0e84056f85cd5cbface38c1f617bfbd0bd4 Mon Sep 17 00:00:00 2001
From: SeongJae Park <sj@...nel.org>
Date: Wed, 24 Dec 2025 07:27:04 -0800
Subject: [PATCH] mm/damon/tests/core-kunit: remove braces for a single
 statement

damon_test_split_regions_of() has braces for a single statement, which
is unnecessary.  Remove it.

Signed-off-by: SeongJae Park <sj@...nel.org>
---
 mm/damon/tests/core-kunit.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h
index 36622a2c11f1..252ce3e001c8 100644
--- a/mm/damon/tests/core-kunit.h
+++ b/mm/damon/tests/core-kunit.h
@@ -318,9 +318,8 @@ static void damon_test_split_regions_of(struct kunit *test)
 	}
 	damon_split_regions_of(t, 4, 5);
 	KUNIT_EXPECT_LE(test, damon_nr_regions(t), 12u);
-	damon_for_each_region(r, t) {
+	damon_for_each_region(r, t)
 		KUNIT_EXPECT_GE(test, damon_sz_region(r) % 5ul, 0ul);
-	}
 	damon_free_target(t);
 }
 
-- 
2.47.3


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ