[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <176363760125.498.15227477726391042766.tip-bot2@tip-bot2>
Date: Thu, 20 Nov 2025 11:20:01 -0000
From: "tip-bot2 for Thomas Gleixner" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Thomas Gleixner <tglx@...utronix.de>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
"Yury Norov (NVIDIA)" <yury.norov@...il.com>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: core/rseq] sched/mmcid: Use cpumask_weighted_or()
The following commit has been merged into the core/rseq branch of tip:
Commit-ID: 79c11fb3da8581a2f222b290ce62a153ab1108fc
Gitweb: https://git.kernel.org/tip/79c11fb3da8581a2f222b290ce62a153ab1108fc
Author: Thomas Gleixner <tglx@...utronix.de>
AuthorDate: Wed, 19 Nov 2025 18:26:59 +01:00
Committer: Peter Zijlstra <peterz@...radead.org>
CommitterDate: Thu, 20 Nov 2025 12:14:54 +01:00
sched/mmcid: Use cpumask_weighted_or()
Use cpumask_weighted_or() instead of cpumask_or() and cpumask_weight() on
the result, which walks the same bitmap twice. Results in 10-20% less
cycles, which reduces the runqueue lock hold time.
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Acked-by: Yury Norov (NVIDIA) <yury.norov@...il.com>
Link: https://patch.msgid.link/20251119172549.511736272@linutronix.de
---
kernel/sched/core.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 2ea77e7..f6bbfa1 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -10377,6 +10377,7 @@ void call_trace_sched_update_nr_running(struct rq *rq, int count)
static inline void mm_update_cpus_allowed(struct mm_struct *mm, const struct cpumask *affmsk)
{
struct cpumask *mm_allowed;
+ unsigned int weight;
if (!mm)
return;
@@ -10387,8 +10388,8 @@ static inline void mm_update_cpus_allowed(struct mm_struct *mm, const struct cpu
*/
guard(raw_spinlock)(&mm->mm_cid.lock);
mm_allowed = mm_cpus_allowed(mm);
- cpumask_or(mm_allowed, mm_allowed, affmsk);
- WRITE_ONCE(mm->mm_cid.nr_cpus_allowed, cpumask_weight(mm_allowed));
+ weight = cpumask_weighted_or(mm_allowed, mm_allowed, affmsk);
+ WRITE_ONCE(mm->mm_cid.nr_cpus_allowed, weight);
}
void sched_mm_cid_exit_signals(struct task_struct *t)
Powered by blists - more mailing lists