Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "SJ Park" <sj@kernel.org>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
	"Usama Arif" <usamaarif642@gmail.com>,
	damon@lists.linux.dev, linux-mm@kvack.org
Subject: Re: [RFC PATCH 6.12.y 1/5] mm/damon/core: skip applying scheme if region split for quota fails
Date: Sat, 07 Nov 2026 21:52:35 +0000	[thread overview]
Message-ID: <sashiko-outbox-203347@kernel.org> (raw)
In-Reply-To: <20261107214525.304638-2-sj@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] mm/damon/core: inaccurate tried stats on split failure in
  damos_apply_scheme()
--

commit fe019f891ca813eff979dfc83e95ba297bc45135
Author: SJ Park <sj@kernel.org>

mm/damon/core: skip applying scheme if region split for quota fails

This commit changes damon_split_region_at() to return an error code on
allocation failure and skips applying the DAMOS scheme in
damos_apply_scheme() when splitting a region to fit the remaining size
quota fails.

Link: https://lore.kernel.org/20260901131850.98037-1-sj@kernel.org
Link: https://lore.kernel.org/20260901131850.98037-2-sj@kernel.org
Link: https://lore.kernel.org/20260718171523.87547-1-sj@kernel.org [1]

> diff --git a/mm/damon/core.c b/mm/damon/core.c
> index 81d44e41de210..6ef77741b783b 100644
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c

[ ... ]

> @@ -1470,7 +1470,8 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t,
>  					DAMON_MIN_REGION);
>  			if (!sz)
>  				goto update_stat;
> -			damon_split_region_at(t, r, sz);
> +			if (damon_split_region_at(t, r, sz))
> +				goto update_stat;
>  		}
>  		if (damos_filter_out(c, t, r, s))
>  			return;

[Severity: Low]
Should this return instead of jumping to update_stat when
damon_split_region_at() fails?

At this point sz holds the non-zero aligned remaining quota, and
update_stat calls damos_update_stat(s, sz, sz_applied), which increments
s->stat.nr_tried and adds sz to s->stat.sz_tried even though scheme
application and filter evaluation were skipped.  Because quota->charged_sz
is not updated on this error path, persistent allocation failures across
subsequent regions larger than the remaining quota will repeatedly add the
remaining quota sz to s->stat.sz_tried and increment s->stat.nr_tried.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261107214525.304638-1-sj@kernel.org?part=1


  reply	other threads:[~2026-11-07 21:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-07 21:45 [RFC PATCH 6.12.y 0/5] mm/damon: porting fixes that cherry-pick failed on 2026-11-07 SJ Park
2026-11-07 21:45 ` [RFC PATCH 6.12.y 1/5] mm/damon/core: skip applying scheme if region split for quota fails SJ Park
2026-11-07 21:52   ` sashiko-bot [this message]
2026-11-07 22:00     ` SJ Park
2026-11-07 21:45 ` [RFC PATCH 6.12.y 2/5] mm/damon/paddr: respect folio end for DAMOS actions except STAT SJ Park
2026-11-07 21:45 ` [RFC PATCH 6.12.y 3/5] mm/damon/core: handle uninitialized damos_quota_goal->last_psi_total SJ Park
2026-11-09  0:34   ` Sasha Levin
2026-11-09  1:15     ` SJ Park
2026-11-07 21:45 ` [RFC PATCH 6.12.y 4/5] mm/damon/core: filter out damos address filter-split failed region SJ Park
2026-11-07 21:45 ` [RFC PATCH 6.12.y 5/5] mm/damon/core: remove unreachable damos charge_{target,addr}_from SJ Park
2026-11-07 21:58   ` sashiko-bot
2026-11-07 22:04     ` SJ 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=sashiko-outbox-203347@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=linux-mm@kvack.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=sj@kernel.org \
    --cc=usamaarif642@gmail.com \
    /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