From nobody Mon Feb 9 16:06:46 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F0946341651 for ; Wed, 15 Oct 2025 17:29:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760549382; cv=none; b=AHT0FxVdklqnFDgx8z1IQoQaD5VkZaiwvFGrZ2MecMS/IvnGPc7b6c/hDR3TgiVGxTNjOZ9jp6LKR+RDHAxqXHR6PvahSmvCttfr9BZXJBS/aDfa/sOzj3blQ5kCqW4a1PQMefi4C7mKLP4jPa74YQWoYvitIF4U/SZHgdjVBjI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760549382; c=relaxed/simple; bh=MtiEhz0wHdPyjeaAls39ddozfjqipwFqzCW6ZelbBxk=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=ndQQ25sLPy54R+fz3R8A5sJw2TcJ/Ztsyj8M8nJRd5DoPVMOri8k2OUkdDoQINNdyADHbZDD+wknuCix1Dei11tt1BgkLwGazCtH9pOd2OZrWe5yuFzR4j6oBcwanSDn2LtYuJ+5UtS9U0Mjc8G+tURQt9RoRR0V9PANyDDi47U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=QLp81ZOL; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=86Qc9Qlh; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="QLp81ZOL"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="86Qc9Qlh" Message-ID: <20251015172834.821167837@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1760549379; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=6czr5gj00vNJ5vkTWTx9oZXFl88VrqJbsZtU7Kcm6x8=; b=QLp81ZOLhfcx3sO8rXZq+reWBE5w6cu1zukdwyArqCoq2F8EF0LtIMC1T9c0IOpSwEFYCj uY7Ak+B9O4CLNo9Ki/wzXicYEwEJ8QR1FTvPKUm5iRX+xXfZFh/Mq9TgnqxWsCgQelllaU PobX/6uzdKwD6UE/9XvrD/6p84ITXXK6Yu+9T0zlYrdis0CIvHiIVO+c3xpNZcqiUP3/bN meG08+FpWOSrie98uSGqr9CLskA8zcqKlBD8wCEGqsvyaUbliQKGQZGwlV5wd7l+/0azm0 B7c3d+a9nKV0cEofPXs7lhLFtZkHiigExIgMUJBAtJIrwBBZVvDBp++40/tp8w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1760549379; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=6czr5gj00vNJ5vkTWTx9oZXFl88VrqJbsZtU7Kcm6x8=; b=86Qc9QlhxN1HtLpCnIgcpVvymUJ3058/OgLX10dTgFqNgA4UUuq36I9GC614w+XwA9ZD8h oUvP0XnOjdzOPrCw== From: Thomas Gleixner To: LKML Cc: Peter Zijlstra , Gabriele Monaco , Mathieu Desnoyers , Michael Jeanson , Jens Axboe , "Paul E. McKenney" , "Gautham R. Shenoy" , Florian Weimer , Tim Chen , TCMalloc Team Subject: [patch 08/19] sched/mmcid: Use cpumask_or_weight() References: <20251015164952.694882104@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Wed, 15 Oct 2025 19:29:38 +0200 (CEST) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use cpumask_or_weight() instead of cpumask_or() and cpumask_weight() on the result, which walks the same bitmap twice. Signed-off-by: Thomas Gleixner --- kernel/sched/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -10409,6 +10409,7 @@ void call_trace_sched_update_nr_running( static inline void mm_update_cpus_allowed(struct mm_struct *mm, const stru= ct cpumask *affmsk) { struct cpumask *mm_allowed; + unsigned int weight; =20 if (!mm || READ_ONCE(mm->mm_cid.nr_cpus_allowed) =3D=3D nr_cpu_ids) return; @@ -10422,8 +10423,8 @@ static inline void mm_update_cpus_allowe if (mm->mm_cid.nr_cpus_allowed =3D=3D nr_cpu_ids) return; mm_allowed =3D mm_cpus_allowed(mm); - cpumask_or(mm_allowed, mm_allowed, affmsk); - WRITE_ONCE(mm->mm_cid.nr_cpus_allowed, cpumask_weight(mm_allowed)); + weight =3D cpumask_or_weight(mm_allowed, mm_allowed, affmsk); + WRITE_ONCE(mm->mm_cid.nr_cpus_allowed, weight); } =20 void sched_mm_cid_exit_signals(struct task_struct *t)