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] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250721200922.79b34a049af4a02947c716ee@linux-foundation.org>
Date: Mon, 21 Jul 2025 20:09:22 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: SeongJae Park <sj@...nel.org>
Cc: Shuah Khan <shuah@...nel.org>, damon@...ts.linux.dev,
 kernel-team@...a.com, linux-kernel@...r.kernel.org,
 linux-kselftest@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH 16/22] selftests/damon/sysfs.py: generalize DAMOS
 schemes commit assertion

On Sun, 20 Jul 2025 10:16:46 -0700 SeongJae Park <sj@...nel.org> wrote:

> DAMOS scheme commitment assertion is hard-coded for a specific test
> case.  Split it out into a general version that can be reused for
> different test cases.
> 

This patch has the same name as [18/22].  I renamed this patch to

"selftests/damon/sysfs.py: generalize DAMOS access pattern commit assertion"

and altered its changelog to

: DAMOS scheme access pattern assertion is hard-coded for a specific test
: case.  Split it out into a general version that can be reused for
: different test cases.

> --- a/tools/testing/selftests/damon/sysfs.py
> +++ b/tools/testing/selftests/damon/sysfs.py
> @@ -76,6 +76,42 @@ def assert_migrate_dests_committed(dests, dump):
>          assert_true(dump['node_id_arr'][idx] == dest.id, 'node_id', dump)
>          assert_true(dump['weight_arr'][idx] == dest.weight, 'weight', dump)
>  
> +def assert_access_pattern_committed(pattern, dump):
> +    assert_true(dump['min_sz_region'] == pattern.size[0], 'min_sz_region',
> +                dump)
> +    assert_true(dump['max_sz_region'] == pattern.size[1], 'max_sz_region',
> +                dump)
> +    assert_true(dump['min_nr_accesses'] == pattern.nr_accesses[0],
> +                'min_nr_accesses', dump)
> +    assert_true(dump['max_nr_accesses'] == pattern.nr_accesses[1],
> +                'max_nr_accesses', dump)
> +    assert_true(dump['min_age_region'] == pattern.age[0], 'min_age_region',
> +                dump)
> +    assert_true(dump['max_age_region'] == pattern.age[1], 'miaxage_region',
> +                dump)
> +
> +def assert_scheme_committed(scheme, dump):
> +    assert_access_pattern_committed(scheme.access_pattern, dump['pattern'])
> +    action_val = {
> +            'willneed': 0,
> +            'cold': 1,
> +            'pageout': 2,
> +            'hugepage': 3,
> +            'nohugeapge': 4,
> +            'lru_prio': 5,
> +            'lru_deprio': 6,
> +            'migrate_hot': 7,
> +            'migrate_cold': 8,
> +            'stat': 9,
> +            }
> +    assert_true(dump['action'] == action_val[scheme.action], 'action', dump)
> +    assert_true(dump['apply_interval_us'] == scheme. apply_interval_us,
> +                'apply_interval_us', dump)
> +    assert_true(dump['target_nid'] == scheme.target_nid, 'target_nid', dump)
> +    assert_migrate_dests_committed(scheme.dests, dump['migrate_dests'])
> +    assert_quota_committed(scheme.quota, dump['quota'])
> +    assert_watermarks_committed(scheme.watermarks, dump['wmarks'])
> +
>  def main():
>      kdamonds = _damon_sysfs.Kdamonds(
>              [_damon_sysfs.Kdamond(
> @@ -122,28 +158,7 @@ def main():
>      if len(ctx['schemes']) != 1:
>          fail('number of schemes', status)
>  
> -    scheme = ctx['schemes'][0]
> -    if scheme['pattern'] != {
> -            'min_sz_region': 0,
> -            'max_sz_region': 2**64 - 1,
> -            'min_nr_accesses': 0,
> -            'max_nr_accesses': 2**32 - 1,
> -            'min_age_region': 0,
> -            'max_age_region': 2**32 - 1,
> -            }:
> -        fail('damos pattern', status)
> -    if scheme['action'] != 9:   # stat
> -        fail('damos action', status)
> -    if scheme['apply_interval_us'] != 0:
> -        fail('damos apply interval', status)
> -    if scheme['target_nid'] != -1:
> -        fail('damos target nid', status)
> -
> -    assert_migrate_dests_committed(_damon_sysfs.DamosDests(),
> -                                   scheme['migrate_dests'])
> -    assert_quota_committed(_damon_sysfs.DamosQuota(), scheme['quota'])
> -    assert_watermarks_committed(_damon_sysfs.DamosWatermarks(),
> -                                scheme['wmarks'])
> +    assert_scheme_committed(_damon_sysfs.Damos(), ctx['schemes'][0])
>  
>      kdamonds.stop()
>  
> -- 
> 2.39.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ