v2
2026-09-14
DAMOS 过滤器范围校验下沉 · v2
v2 将 DAMON scheme filter 范围校验移入 core:damos_commit_filter_arg 返回错误并禁止 max<min,同时精简 sysfs 校验。
原始补丁链接
子 Patch(8)
1/8
mm/damon/sysfs-schemes: read sysfs_filter->addr_range only once
DAMON sysfs interface reads the user-provided address range arguments for addr type DAMOS filter twice. Once for validation, and once again for assignments to the variable that will be passed to the
2/8
mm/damon/sysfs-schemes: read sysfs_filter->sz_range only once
DAMON sysfs interface reads the user-provided size range arguments for hugepage_size type DAMOS filter twice. Once for validation, and once again for assignments to the variable that will be passed t
3/8
mm/damon/core: return an error from damos_commit_filter_arg()
damos_commit_filter_arg() is supposed to always succeed. It may not in future, for example, if the given filter is invalid. Prepare the case by modifying its signature to return an error when it fai
4/8
mm/damon/core: disallow max < min damos filter range arguments commit
damos_commit_filter_arg() receives range arguments for a few types of DAMOS filters. It allows any range including max < min range. It is fine for the logic, but makes no sense to support it. Actua
5/8
mm/damon/sysfs-schemes: drop centralized filter range arg validations
DAMON sysfs interface is validating wrong range arguments for DAMOS filters. Now the core layer is doing the same validation. Drop the duplicated validation in DAMON sysfs interface. Signed-off-by:
6/8
mm/damon/sysfs-schemes: use switch-case in add_scheme_filters()
damon_sysfs_add_scheeme_filters() has long if-else chains for DAMOS filter types. Convert the code to use switch-case, which would be cleaner and more efficient. Signed-off-by: SJ Park <sj@kernel.or
7/8
mm/damon/core-kunit: extend damos_commit_filter_for() for wrong input
damos_commit_filter_for() supposes damos_commit_filter() to always succeed with given inputs. damos_commit_filter() could return an error for invalid inputs. Existing callers always pass only valid
8/8
mm/damon/core-kunit: test invalid damos filter commits
Add test cases for testing the validation of damos filter arguments in commit time. Signed-off-by: SJ Park sj@kernel.org — mm/damon/tests/core-kunit.h | 14 ++++++++++++++ 1 file changed , 14 in