Skip to contentSkip to conversation

mm-damon-core-use-time_in_range_open-for-damos-quota-window-start.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Apr 18 Stable branch

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/damon/core: use time_in_range_open() for damos quota window start
has been removed from the -mm tree. Its filename was
mm-damon-core-use-time_in_range_open-for-damos-quota-window-start.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: SeongJae Park <[email protected]>
Subject: mm/damon/core: use time_in_range_open() for damos quota window start
Date: Sun, 29 Mar 2026 08:23:05 -0700

damos_adjust_quota() uses time_after_eq() to show if it is time to start a new quota charge window, comparing the current jiffies and the scheduled next charge window start time. If it is, the next charge window start time is updated and the new charge window starts.

The time check and next window start time update is skipped while the scheme is deactivated by the watermarks. Let's suppose the deactivation is kept more than LONG_MAX jiffies (assuming CONFIG_HZ of 250, more than 99 days in 32 bit systems and more than one billion years in 64 bit systems), resulting in having the jiffies larger than the next charge window start time + LONG_MAX. Then, the time_after_eq() call can return false until another LONG_MAX jiffies are passed.

This means the scheme can continue working after being reactivated by the watermarks. But, soon, the quota will be exceeded and the scheme will again effectively stop working until the next charge window starts. Because the current charge window is extended to up to LONG_MAX jiffies, however, it will look like it stopped unexpectedly and indefinitely, from the user's perspective.

Fix this by using !time_in_range_open() instead.

The issue was discovered [1] by sashiko.

Fixes ee801b7dd782 ("mm/damon/schemes: activate schemes based on a watermarks mechanism")
Cc <[email protected]> # 5.16.x

---

 mm/damon/core.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
mm/damon/core.c renamed from mm/damon/core.c~mm-damon-core-use-time_in_range_open-for-damos-quota-window-start +2 -1
@@ -2449,7 +2449,8 @@ static void damos_adjust_quota(struct da
 	}
 
 	/* New charge window starts */
-	if (time_after_eq(jiffies, quota->charged_from +
+	if (!time_in_range_open(jiffies, quota->charged_from,
+				quota->charged_from +
 				msecs_to_jiffies(quota->reset_interval))) {
 		if (damos_quota_is_set(quota) &&
 				quota->charged_sz >= quota->esz)

_

Patches currently in -mm which might be from [email protected] are

mm-damon-core-disallow-time-quota-setting-zero-esz.patch mm-damon-core-disallow-non-power-of-two-min_region_sz-on-damon_start.patch