Re: [RFC PATCH 08/10] selftests/damon/sysfs.sh: test hugepage_mem_bp quota goal

SJ Park <[email protected]> Mon, 27 Jul 2026 22:56:05 -0700
Newsgroups dev.linux.lists.damon
Message-ID <[email protected]>
On Tue, 28 Jul 2026 05:35:33 +0000 [email protected] wrote:

> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] The selftest unconditionally fails because the kernel implementation for the 'hugepage_mem_bp' quota goal target metric is missing.
> --
> 
> --- Patch [8]: [RFC PATCH 08/10] selftests/damon/sysfs.sh: test hugepage_mem_bp quota goal ---
> commit 033ea051e9d9dfb2787f833f5569853c4af61194
> Author: SJ Park <[email protected]>
> 
> selftests/damon/sysfs.sh: test hugepage_mem_bp quota goal
> 
> DAMON sysfs quota goal target_metric file now accepts 'hugepage_mem_bp'
> input. Test it is accepted in fundamental DAMON sysfs file operation
> selftest.
> 
> > diff --git a/tools/testing/selftests/damon/sysfs.sh b/tools/testing/selftests/damon/sysfs.sh
> > --- a/tools/testing/selftests/damon/sysfs.sh
> > +++ b/tools/testing/selftests/damon/sysfs.sh
> > @@ -210,6 +210,7 @@ test_goal()
> >  	ensure_write_succ "$fpath" "active_mem_bp" "valid input"
> >  	ensure_write_succ "$fpath" "inactive_mem_bp" "valid input"
> >  	ensure_write_succ "$fpath" "node_eligible_mem_bp" "valid input"
> > +	ensure_write_succ "$fpath" "hugepage_mem_bp" "valid input"
> 
> [Severity: Medium]
> Will this selftest fail when executed?
> 
> Looking at target_metric_store() in mm/damon/sysfs-schemes.c, the kernel
> validation loop returns -EINVAL because "hugepage_mem_bp" is not present in
> the damos_sysfs_qgoal_metric_names array:
> 
> mm/damon/sysfs-schemes.c:target_metric_store() {
> 	...
> 	for (i = 0; i < ARRAY_SIZE(damos_sysfs_qgoal_metric_names); i++) {
> 		struct damos_sysfs_qgoal_metric_name *metric_name;
> 
> 		metric_name = &damos_sysfs_qgoal_metric_names[i];
> 		if (sysfs_streq(buf, metric_name->name)) {
> 			goal->metric = metric_name->metric;
> 			return count;
> 		}
> 	}
> 	return -EINVAL;
> }
> 
> Because the test assumes the write will succeed, the missing kernel
> implementation for this quota goal target metric will cause the write to be
> rejected and trigger a selftest failure.

Implementation of hugepage_mem_bp is not yet in mm-new, but will be merged
before this series.  So, no issue.

> 
> >  	ensure_write_fail "$fpath" "foo" "invalid input"
> >  	ensure_file "$goal_dir/nid" "exist" "600"
> >  	ensure_file "$goal_dir/path" "exist" "600"
> 
> -- 
> Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=8


Thanks,
SJ