FAILED: patch "[PATCH] mm/damon/core: keep the temporal tuner quota over an unmeasured PSI round" failed to apply to 6.18-stable tree
Subsystems (3)
Sasha Levin
maintainerThe patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x df7d9a0f8d916eeea375430ae3360724afecde15
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From df7d9a0f8d916eeea375430ae3360724afecde15 Mon Sep 17 00:00:00 2001
From: Karl Mehltretter <[email protected]>
Date: Tue, 22 Sep 2026 22:51:37 -0700
Subject: [PATCH] mm/damon/core: keep the temporal tuner quota over an
unmeasured PSI round
The patch in mm-unstable of subject "mm/damon/core: handle uninitialized damos_quota_goal->last_psi_total" scores a PSI quota goal without a previous sample as achieved. This leaves the consist tuner's input unchanged, but the temporal tuner sets its quota to zero for an achieved goal. A running scheme with a nonzero temporal quota therefore loses a charge window after a quota-goal commit.
Use the effective quota to preserve the temporal tuner's previous goal-achievement state during an unmeasured round, as SJ suggested [1]. Score the goal as achieved when the effective quota is zero and as not achieved otherwise. A new scheme's initially zero quota stays zero, and the consist tuner's behavior is unchanged.
Move the PSI current-value calculation and last_psi_total update into a helper that takes the current PSI total. This lets a unit test cover the unmeasured and measured rounds without depending on system memory pressure.
--- mm/damon/core.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-)
mm/damon/core.c +23 -7
@@ -2891,6 +2891,28 @@ static inline u64 damos_get_some_mem_psi_total(void)#endif /* CONFIG_PSI */ +static void damos_set_psi_current_val (u64 now_psi_total, +struct damos_quota_goal *goal,struct damos *s) +{ +u64 last_psi_total = goal->last_psi_total; + + goal->last_psi_total = now_psi_total; +if (last_psi_total !=U64_MAX ) { + goal->current_value = now_psi_total - last_psi_total; +return ; + } +/* uninitialized last_psi_total; make no effect this round */ +if (s->quota.goal_tuner ==DAMOS_QUOTA_GOAL_TUNER_CONSIST ) { + goal->current_value = goal->target_value; +return ; + } +/* let temporal tuner show the same achievement as in the last round */ +if (!s->quota.esz) + goal->current_value = goal->target_value; +else + goal->current_value =0 ; +} +#ifdef CONFIG_NUMA static bool invalid_mem_node (int nid) {
@@ -3143,13 +3165,7 @@ static void damos_set_quota_goal_current_value(struct damon_ctx *c,break ;case DAMOS_QUOTA_SOME_MEM_PSI_US : now_psi_total =damos_get_some_mem_psi_total (); -/* uninitialized last_psi_total; make no effect this round */ -if (goal->last_psi_total ==U64_MAX ) - goal->current_value = goal->target_value; -else - goal->current_value = now_psi_total - - goal->last_psi_total; - goal->last_psi_total = now_psi_total; +damos_set_psi_current_val (now_psi_total, goal, s);break ;case DAMOS_QUOTA_NODE_MEM_USED_BP :case DAMOS_QUOTA_NODE_MEM_FREE_BP :
Signature · 1 line
2.53.0
SJ Park
maintainerHello,
Quoted 4 lines · On Sat, 7 Nov 2026 05:08:54 -0500 Sasha Levin <[email protected]> wrote:
The patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
TL;DR: the patch is not needed for 6.18.y. Please ignore this failure.
Quoted 21 lines
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkoutFETCH_HEAD
git cherry-pick -xdf7d9a0f8d916eeea375430ae3360724afecde15
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'Thanks,
Sasha------------------ original commit in Linus's tree ------------------
Quoted 1 line
From
df7d9a0f8d916eeea375430ae3360724afecde15Mon Sep 17 00:00:00 2001From: Karl Mehltretter <[email protected]>
Date: Tue, 22 Sep 2026 22:51:37 -0700
Subject: [PATCH]mm/damon/core: keep the temporal tuner quota over an
unmeasured PSI round
Quoted 6 lines
The patch in mm-unstable of subject "
mm/damon/core: handle uninitializeddamos_quota_goal->last_psi_total" scores a PSI quota goal without a previous sample as achieved. This leaves the consist tuner's input unchanged, but the temporal tuner sets its quota to zero for an achieved goal. A running scheme with a nonzero temporal quota therefore loses a charge window after a quota-goal commit.
This patch was meant to be squashed into the mm-unstable patch before being mainlined. But seems I failed at clearly communicating it to Andrew, and checking it further.
This fixup is needed for only temporal tuner available kernel. Temporal tuner was merged on 7.1. So, this patch is not needed for 6.18.y.
Quoted 7 lines
Use the effective quota to preserve the temporal tuner's previous goal-achievement state during an unmeasured round, as SJ suggested [1]. Score the goal as achieved when the effective quota is zero and as not achieved otherwise. A new scheme's initially zero quota stays zero, and the consist tuner's behavior is unchanged.
Quoted 8 lines
Move the PSI current-value calculation and
last_psi_totalupdate into a helper that takes the current PSI total. This lets a unit test cover the unmeasured and measured rounds without depending on system memory pressure.Fixes 2dbb60f789cb ("mm/damon/core: implement PSI metric DAMOS quota goal")
FWIW, the above Fixes: is the Fixes: of the mm-unstable patch that this patch was intended to be squashed into. Hence the above is incorrect. Correct one should be below:
Thanks,
SJ
[...]