From: SeongJae Park <sj@kernel.org>
To: SeongJae Park <sj@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
damon@lists.linux.dev, kernel-team@meta.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [RFC PATCH 7/9] mm/damon/core: set damos_filter default allowance behavior based on installed filters
Date: Wed, 26 Feb 2025 16:29:13 -0800 [thread overview]
Message-ID: <20250227002913.19359-1-sj@kernel.org> (raw)
In-Reply-To: <20250220193509.36379-8-sj@kernel.org>
On Thu, 20 Feb 2025 11:35:07 -0800 SeongJae Park <sj@kernel.org> wrote:
> Decide whether to allow or reject by default on core and opertions layer
> handled filters evaluation stages, based on the last-installed filter's
> behavior. It is the opposite of the last installed filter's behavior.
> If there is any operations layer handled filters, core layer handled
> filters stage keeps allowing as the default behavior, since the last
> filter of core layer handled filters in the case is not really the last
> filter of the entire filtering stage.
The last sentence describing behavior is not really implemented with this
commit. See below.
>
> Signed-off-by: SeongJae Park <sj@kernel.org>
> ---
> mm/damon/core.c | 31 +++++++++++++++++++++++++++++--
> 1 file changed, 29 insertions(+), 2 deletions(-)
>
> diff --git a/mm/damon/core.c b/mm/damon/core.c
> index 78126a5145fd..9744ab9ca5c5 100644
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
> @@ -864,6 +864,29 @@ static int damos_commit_ops_filters(struct damos *dst, struct damos *src)
> return 0;
> }
>
> +/**
> + * damos_filters_default_reject() - decide whether to reject memory that didn't
> + * match with any given filter.
> + * @filters: Given DAMOS filters of a group.
> + */
> +static bool damos_filters_default_reject(struct list_head *filters)
> +{
> + struct damos_filter *last_filter;
> +
> + if (list_empty(filters))
> + return false;
> + last_filter = list_last_entry(filters, struct damos_filter, list);
> + return last_filter->allow;
> +}
> +
> +static void damos_set_filters_default_reject(struct damos *s)
> +{
> + s->core_filters_default_reject =
> + damos_filters_default_reject(&s->filters);
> + s->ops_filters_default_reject =
> + damos_filters_default_reject(&s->ops_filters);
> +}
->core_filters_default_reject should be 'false' if s->ops_filters is not empty,
since the last one of ->ops_filters is not the real last filter. But this code
is not handling the case.
I will fix this in the next revision.
Thanks,
SJ
[...]
next prev parent reply other threads:[~2025-02-27 0:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-20 19:35 [RFC PATCH 0/9] mm/damon: make allow filters after reject filters useful and intuitive SeongJae Park
2025-02-20 19:35 ` [RFC PATCH 1/9] mm/damon/core: introduce damos->ops_filters SeongJae Park
2025-02-20 19:35 ` [RFC PATCH 2/9] mm/damon/paddr: support ops_filters SeongJae Park
2025-02-20 19:35 ` [RFC PATCH 3/9] mm/damon/core: support committing ops_filters SeongJae Park
2025-02-20 19:35 ` [RFC PATCH 4/9] mm/damon/core: put ops-handled filters to damos->ops_filters SeongJae Park
2025-02-20 19:35 ` [RFC PATCH 5/9] mm/damon/paddr: support only ops_filters SeongJae Park
2025-02-20 19:35 ` [RFC PATCH 6/9] mm/damon: add default allow/reject behavior fields to struct damos SeongJae Park
2025-02-20 19:35 ` [RFC PATCH 7/9] mm/damon/core: set damos_filter default allowance behavior based on installed filters SeongJae Park
2025-02-27 0:29 ` SeongJae Park [this message]
2025-02-20 19:35 ` [RFC PATCH 8/9] mm/damon/paddr: respect ops_filters_default_reject SeongJae Park
2025-02-20 19:35 ` [RFC PATCH 9/9] Docs/mm/damon/design: update for changed filter-default behavior SeongJae Park
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250227002913.19359-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox