[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <176392463742.498.9762634691842916515.tip-bot2@tip-bot2>
Date: Sun, 23 Nov 2025 19:03:57 -0000
From: "tip-bot2 for Thomas Gleixner" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Nathan Chancellor <nathan@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: core/rseq] sched/mmcid: Ensure that per CPU threshold is > 0
The following commit has been merged into the core/rseq branch of tip:
Commit-ID: 14b2b17cca541bf46341beb912cf4420ff27a0c7
Gitweb: https://git.kernel.org/tip/14b2b17cca541bf46341beb912cf4420ff27a0c7
Author: Thomas Gleixner <tglx@...utronix.de>
AuthorDate: Sat, 22 Nov 2025 15:54:39 +01:00
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Sun, 23 Nov 2025 19:59:30 +01:00
sched/mmcid: Ensure that per CPU threshold is > 0
When num_possible_cpus() == 1 then the calculation for the threshold to
switch back from per CPU mode to per task mode results in 0, which
indicates that the per CPU mode is disabled.
Ensure that the threshold is > 0 to prevent that.
Fixes: 340af997d25d ("sched/mmcid: Provide CID ownership mode fixup functions")
Reported-by: Nathan Chancellor <nathan@...nel.org>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Link: https://patch.msgid.link/873466jekm.ffs@tglx
Closes: https://lore.kernel.org/all/20251122004358.GB2682494@ax162
---
kernel/sched/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 5821968..58b4dbe 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -10364,7 +10364,8 @@ static inline unsigned int mm_cid_calc_pcpu_thrs(struct mm_mm_cid *mc)
unsigned int opt_cids;
opt_cids = min(mc->nr_cpus_allowed, mc->users);
- return min(opt_cids - opt_cids / 4, num_possible_cpus() / 2);
+ /* Has to be at least 1 because 0 indicates PCPU mode off */
+ return max(min(opt_cids - opt_cids / 4, num_possible_cpus() / 2), 1);
}
static bool mm_update_max_cids(struct mm_struct *mm)
Powered by blists - more mailing lists