DAMON development mailing list
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: SeongJae Park <sj@kernel.org>
Cc: sashiko-bot@kernel.org,
	"Ravi Jonnalagadda" <ravis.opensrc@gmail.com>,
	damon@lists.linux.dev
Subject: [PATCH for-sashiko] mm/damon/core: (fixup) break calc_eligible_bytes() loop if addr overflows
Date: Mon, 27 Apr 2026 07:58:30 -0700	[thread overview]
Message-ID: <20260427145831.112393-1-sj@kernel.org> (raw)
In-Reply-To: <20260427145331.112239-1-sj@kernel.org>

As Sashiko pointed out, it could result in infinite loop.  Check the
overflow and break the loop in the case.

Also, wrap the addr setup line to keep the 80 columns limit.

Signed-off-by: SeongJae Park <sj@kernel.org>
---
NOTE:
Writing entire patches for minor Sashiko finding is tiresome.  This is an
experimental posting of fixup patch, wishing Sashiko to review this kind of
incremental fixup.
---
 mm/damon/core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mm/damon/core.c b/mm/damon/core.c
index 22d6eb3a974d4..9a4220174a61a 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -2349,7 +2349,10 @@ static phys_addr_t damos_calc_eligible_bytes(struct damon_ctx *c,
 
 				folio = damon_get_folio(PHYS_PFN(addr));
 				if (!folio) {
-					addr = PAGE_ALIGN_DOWN(addr + PAGE_SIZE);
+					addr = PAGE_ALIGN_DOWN(addr +
+							PAGE_SIZE);
+					if (!addr)
+						break;
 					continue;
 				}
 
-- 
2.47.3



  reply	other threads:[~2026-04-27 14:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27  1:02 [PATCH v9.1] mm/damon: add node_eligible_mem_bp goal metric Ravi Jonnalagadda
2026-04-27  1:24 ` sashiko-bot
2026-04-27 14:53   ` SeongJae Park
2026-04-27 14:58     ` SeongJae Park [this message]
2026-04-27 14:49 ` 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=20260427145831.112393-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=damon@lists.linux.dev \
    --cc=ravis.opensrc@gmail.com \
    --cc=sashiko-bot@kernel.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