linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: Gutierrez Asier <gutierrez.asier@huawei-partners.com>
Cc: SeongJae Park <sj@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	damon@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org
Subject: Re: [RFC PATCH v2 02/10] mm/damon/core: allow quota goals set zero effective size quota
Date: Wed,  4 Mar 2026 06:51:39 -0800	[thread overview]
Message-ID: <20260304145140.172293-1-sj@kernel.org> (raw)
In-Reply-To: <abdb1acc-5f88-483f-af49-45276ab66ff0@huawei-partners.com>

On Wed, 4 Mar 2026 13:18:16 +0300 Gutierrez Asier <gutierrez.asier@huawei-partners.com> wrote:

> 
> 
> On 3/4/2026 7:41 AM, SeongJae Park wrote:
> 
> I find the name of this function confusing. The function doesn't
> actually set anything. Maybe better damos_quota_is_set()
> > +/*
> > + * damos_quota_set() - Return if the given quota is actually set.
> > + * @quota:	The quota to check.
> > + *
> > + * Returns true if the quota is set, false otherwise.
> > + */
> > +static bool damos_quota_set(struct damos_quota *quota)
> > +{
> > +	return quota->esz || quota->sz || quota->ms ||
> > +		!damos_quota_goals_empty(quota);
> > +}
> > +

Thank you for the nice suggestion, I agree your points and like the suggested
name!

Andrew, if you pick this patch to mm-new for more reviews, could you please add
below attaching fixup together?


Thanks,
SJ

[...]
=== >8 ===
From 9599524cc5e5bbe8263c847b6f20f0aa919b3853 Mon Sep 17 00:00:00 2001
From: SeongJae Park <sj@kernel.org>
Date: Wed, 4 Mar 2026 06:46:55 -0800
Subject: [PATCH] mm/damon/core: rename damos_quota_set() to
 damos_quota_is_set()

damos_quota_set() can be confused as a sort of setter function.  Rename.

Suggested-by: Gutierrez Asier <gutierrez.asier@huawei-partners.com>
Signed-off-by: SeongJae Park <sj@kernel.org>
---
 mm/damon/core.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/mm/damon/core.c b/mm/damon/core.c
index d657b87dd99e8..c58430a4cd6ef 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -1788,12 +1788,12 @@ static bool __damos_valid_target(struct damon_region *r, struct damos *s)
 }
 
 /*
- * damos_quota_set() - Return if the given quota is actually set.
+ * damos_quota_is_set() - Return if the given quota is actually set.
  * @quota:	The quota to check.
  *
  * Returns true if the quota is set, false otherwise.
  */
-static bool damos_quota_set(struct damos_quota *quota)
+static bool damos_quota_is_set(struct damos_quota *quota)
 {
 	return quota->esz || quota->sz || quota->ms ||
 		!damos_quota_goals_empty(quota);
@@ -1804,7 +1804,7 @@ static bool damos_valid_target(struct damon_ctx *c, struct damon_region *r,
 {
 	bool ret = __damos_valid_target(r, s);
 
-	if (!ret || !damos_quota_set(&s->quota) || !c->ops.get_scheme_score)
+	if (!ret || !damos_quota_is_set(&s->quota) || !c->ops.get_scheme_score)
 		return ret;
 
 	return c->ops.get_scheme_score(c, r, s) >= s->quota.min_score;
@@ -2074,7 +2074,7 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t,
 	}
 
 	if (c->ops.apply_scheme) {
-		if (damos_quota_set(quota) &&
+		if (damos_quota_is_set(quota) &&
 				quota->charged_sz + sz > quota->esz) {
 			sz = ALIGN_DOWN(quota->esz - quota->charged_sz,
 					c->min_region_sz);
@@ -2094,7 +2094,7 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t,
 		quota->total_charged_ns += timespec64_to_ns(&end) -
 			timespec64_to_ns(&begin);
 		quota->charged_sz += sz;
-		if (damos_quota_set(quota) &&
+		if (damos_quota_is_set(quota) &&
 				quota->charged_sz >= quota->esz) {
 			quota->charge_target_from = t;
 			quota->charge_addr_from = r->ar.end + 1;
@@ -2123,7 +2123,8 @@ static void damon_do_apply_schemes(struct damon_ctx *c,
 			continue;
 
 		/* Check the quota */
-		if (damos_quota_set(quota) && quota->charged_sz >= quota->esz)
+		if (damos_quota_is_set(quota) &&
+				quota->charged_sz >= quota->esz)
 			continue;
 
 		if (damos_skip_charged_region(t, r, s, c->min_region_sz))
@@ -2408,7 +2409,8 @@ static void damos_adjust_quota(struct damon_ctx *c, struct damos *s)
 	/* New charge window starts */
 	if (time_after_eq(jiffies, quota->charged_from +
 				msecs_to_jiffies(quota->reset_interval))) {
-		if (damos_quota_set(quota) && quota->charged_sz >= quota->esz)
+		if (damos_quota_is_set(quota) &&
+				quota->charged_sz >= quota->esz)
 			s->stat.qt_exceeds++;
 		quota->total_charged_sz += quota->charged_sz;
 		quota->charged_from = jiffies;
-- 
2.47.3



  reply	other threads:[~2026-03-04 14:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04  4:41 [RFC PATCH v2 00/10] mm/damon: support multiple goal-based quota tuning algorithms SeongJae Park
2026-03-04  4:41 ` [RFC PATCH v2 01/10] mm/damon/core: introduce damos_quota_goal_tuner SeongJae Park
2026-03-04  4:41 ` [RFC PATCH v2 02/10] mm/damon/core: allow quota goals set zero effective size quota SeongJae Park
2026-03-04 10:18   ` Gutierrez Asier
2026-03-04 14:51     ` SeongJae Park [this message]
2026-03-04  4:41 ` [RFC PATCH v2 03/10] mm/damon/core: introduce DAMOS_QUOTA_GOAL_TUNER_TEMPORAL SeongJae Park
2026-03-04  4:41 ` [RFC PATCH v2 04/10] mm/damon/sysfs-schemes: implement quotas->goal_tuner file SeongJae Park
2026-03-04  4:41 ` [RFC PATCH v2 05/10] Docs/mm/damon/design: document the goal-based quota tuner selections SeongJae Park
2026-03-04  4:41 ` [RFC PATCH v2 06/10] Docs/admin-guide/mm/damon/usage: document goal_tuner sysfs file SeongJae Park
2026-03-04  4:41 ` [RFC PATCH v2 07/10] Docs/ABI/damon: update for goal_tuner SeongJae Park
2026-03-04  4:41 ` [RFC PATCH v2 08/10] selftests/damon/_damon_sysfs: support goal_tuner setup SeongJae Park
2026-03-04  4:41 ` [RFC PATCH v2 09/10] selftests/damon/drgn_dump_damon_status: support quota goal_tuner dumping SeongJae Park
2026-03-04  4:41 ` [RFC PATCH v2 10/10] selftests/damon/sysfs.py: test goal_tuner commit SeongJae Park
2026-03-04 10:15 ` [RFC PATCH v2 00/10] mm/damon: support multiple goal-based quota tuning algorithms Gutierrez Asier
2026-03-04 15:03   ` 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=20260304145140.172293-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=gutierrez.asier@huawei-partners.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