* [PATCH] sched/mmcid: Use clamp to simplify mm_cid_calc_pcpu_thrs
@ 2026-02-24 20:24 Thorsten Blum
0 siblings, 0 replies; only message in thread
From: Thorsten Blum @ 2026-02-24 20:24 UTC (permalink / raw)
To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider
Cc: Thorsten Blum, linux-kernel
Replace nested max(min()) with clamp() to simplify
mm_cid_calc_pcpu_thrs(). No functional changes.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
kernel/sched/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 759777694c78..8c3920918596 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -10473,7 +10473,7 @@ static inline unsigned int mm_cid_calc_pcpu_thrs(struct mm_mm_cid *mc)
opt_cids = min(mc->nr_cpus_allowed, mc->users);
/* 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);
+ return clamp(opt_cids - opt_cids / 4, 1, num_possible_cpus() / 2);
}
static bool mm_update_max_cids(struct mm_struct *mm)
--
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-02-24 20:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-24 20:24 [PATCH] sched/mmcid: Use clamp to simplify mm_cid_calc_pcpu_thrs Thorsten Blum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome