Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/damon: rename damos core filter helpers to have word core

Patch series "mm/damon: misc cleanups".

Yet another batch of misc cleanups and refactoring for DAMON code, tests,
and documents.

First two patches (1and 2) rename DAMOS core filters related code for
readability.

Three following patches (3-5) refactor page table walk callback functions
in DAMON, as suggested by Hugh and David, and I promised.

Next two patches (6 and 7) refactor DAMON core layer kunit test and sysfs
interface selftest to be simple and deduplicated.

Final two patches (8 and 9) fix up sphinx and grammatical errors on
documents.


This patch (of 9):

DAMOS filters handled by the core layer are called core filters, while
those handled by the ops layer are called ops filters. They share the
same type but are managed in different places since core filters are
evaluated before the ops filters. They also have different helper
functions that depend on their managed places.

The helper functions for ops filters have '_ops_' keyword on their name,
so it is easy to know they are for ops filters. Meanwhile, the helper
functions for core filters are not having the 'core' keyword on their
name. This makes it easy to be mistakenly used for ops filters. Actually
there was such a bug.

To avoid future mistakes from similar confusions, rename DAMOS core
filters helper functions to have a keyword 'core' on their names.

Link: https://lkml.kernel.org/r/20251112154114.66053-1-sj@kernel.org
Link: https://lkml.kernel.org/r/20251112154114.66053-2-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: Bill Wendling <morbo@google.com>
Cc: Brendan Higgins <brendan.higgins@linux.dev>
Cc: David Gow <davidgow@google.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Justin Stitt <justinstitt@google.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Miguel Ojeda <ojeda@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: David Hildenbrand <david@kernel.org>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

SeongJae Park and committed by
Andrew Morton
8b02baf3 1ec5d581

+11 -11
+2 -2
.clang-format
··· 140 140 - 'damon_for_each_scheme_safe' 141 141 - 'damon_for_each_target' 142 142 - 'damon_for_each_target_safe' 143 - - 'damos_for_each_filter' 144 - - 'damos_for_each_filter_safe' 143 + - 'damos_for_each_core_filter' 144 + - 'damos_for_each_core_filter_safe' 145 145 - 'damos_for_each_ops_filter' 146 146 - 'damos_for_each_ops_filter_safe' 147 147 - 'damos_for_each_quota_goal'
+2 -2
include/linux/damon.h
··· 871 871 #define damos_for_each_quota_goal_safe(goal, next, quota) \ 872 872 list_for_each_entry_safe(goal, next, &(quota)->goals, list) 873 873 874 - #define damos_for_each_filter(f, scheme) \ 874 + #define damos_for_each_core_filter(f, scheme) \ 875 875 list_for_each_entry(f, &(scheme)->filters, list) 876 876 877 - #define damos_for_each_filter_safe(f, next, scheme) \ 877 + #define damos_for_each_core_filter_safe(f, next, scheme) \ 878 878 list_for_each_entry_safe(f, next, &(scheme)->filters, list) 879 879 880 880 #define damos_for_each_ops_filter(f, scheme) \
+7 -7
mm/damon/core.c
··· 450 450 damos_for_each_quota_goal_safe(g, g_next, &s->quota) 451 451 damos_destroy_quota_goal(g); 452 452 453 - damos_for_each_filter_safe(f, next, s) 453 + damos_for_each_core_filter_safe(f, next, s) 454 454 damos_destroy_filter(f); 455 455 456 456 damos_for_each_ops_filter_safe(f, next, s) ··· 864 864 return 0; 865 865 } 866 866 867 - static struct damos_filter *damos_nth_filter(int n, struct damos *s) 867 + static struct damos_filter *damos_nth_core_filter(int n, struct damos *s) 868 868 { 869 869 struct damos_filter *filter; 870 870 int i = 0; 871 871 872 - damos_for_each_filter(filter, s) { 872 + damos_for_each_core_filter(filter, s) { 873 873 if (i++ == n) 874 874 return filter; 875 875 } ··· 923 923 struct damos_filter *dst_filter, *next, *src_filter, *new_filter; 924 924 int i = 0, j = 0; 925 925 926 - damos_for_each_filter_safe(dst_filter, next, dst) { 927 - src_filter = damos_nth_filter(i++, src); 926 + damos_for_each_core_filter_safe(dst_filter, next, dst) { 927 + src_filter = damos_nth_core_filter(i++, src); 928 928 if (src_filter) 929 929 damos_commit_filter(dst_filter, src_filter); 930 930 else 931 931 damos_destroy_filter(dst_filter); 932 932 } 933 933 934 - damos_for_each_filter_safe(src_filter, next, src) { 934 + damos_for_each_core_filter_safe(src_filter, next, src) { 935 935 if (j++ < i) 936 936 continue; 937 937 ··· 1767 1767 struct damos_filter *filter; 1768 1768 1769 1769 s->core_filters_allowed = false; 1770 - damos_for_each_filter(filter, s) { 1770 + damos_for_each_core_filter(filter, s) { 1771 1771 if (damos_filter_match(ctx, t, r, filter, ctx->min_sz_region)) { 1772 1772 if (filter->allow) 1773 1773 s->core_filters_allowed = true;