mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Shrikanth Hegde" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Shrikanth Hegde <sshegde@linux.ibm.com>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: sched/core] sched/deadline: Use cpumask_weight_and() in dl_bw_cpus
Date: Tue, 11 Nov 2025 11:37:14 -0000	[thread overview]
Message-ID: <176286103469.498.8073260484561257707.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20251014100342.978936-3-sshegde@linux.ibm.com>

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     7259e53915cc99298952a35aa8772d33d1e51866
Gitweb:        https://git.kernel.org/tip/7259e53915cc99298952a35aa8772d33d1e51866
Author:        Shrikanth Hegde <sshegde@linux.ibm.com>
AuthorDate:    Tue, 14 Oct 2025 15:33:42 +05:30
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Tue, 11 Nov 2025 12:33:39 +01:00

sched/deadline: Use cpumask_weight_and() in dl_bw_cpus

cpumask_subset(a,b) -> cpumask_weight(a) should be same as cpumask_weight_and(a,b)
for_each_cpu_and(a,b) to count cpus could be replaced by cpumask_weight_and(a,b)

No Functional Change. It could save a few cycles since cpumask_weight_and
would be more efficient. Plus one less stack variable.

Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Juri Lelli <juri.lelli@redhat.com>
Link: https://patch.msgid.link/20251014100342.978936-3-sshegde@linux.ibm.com
---
 kernel/sched/deadline.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 4d6eaf2..e46df89 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -125,20 +125,11 @@ static inline struct dl_bw *dl_bw_of(int i)
 static inline int dl_bw_cpus(int i)
 {
 	struct root_domain *rd = cpu_rq(i)->rd;
-	int cpus;
 
 	RCU_LOCKDEP_WARN(!rcu_read_lock_sched_held(),
 			 "sched RCU must be held");
 
-	if (cpumask_subset(rd->span, cpu_active_mask))
-		return cpumask_weight(rd->span);
-
-	cpus = 0;
-
-	for_each_cpu_and(i, rd->span, cpu_active_mask)
-		cpus++;
-
-	return cpus;
+	return cpumask_weight_and(rd->span, cpu_active_mask);
 }
 
 static inline unsigned long __dl_bw_capacity(const struct cpumask *mask)

  parent reply	other threads:[~2025-11-11 11:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-14 10:03 [PATCH 0/2] sched/deadline: minor code cleanups Shrikanth Hegde
2025-10-14 10:03 ` [PATCH 1/2] " Shrikanth Hegde
2025-11-10 14:10   ` Peter Zijlstra
2025-11-10 14:17     ` Peter Zijlstra
2025-11-11 11:37   ` [tip: sched/core] sched/deadline: Minor cleanup in select_task_rq_dl() tip-bot2 for Shrikanth Hegde
2025-11-11 16:33   ` tip-bot2 for Shrikanth Hegde
2025-10-14 10:03 ` [PATCH 2/2] sched/deadline: Use cpumask_weight_and in dl_bw_cpus Shrikanth Hegde
2025-11-10 14:11   ` Peter Zijlstra
2025-11-11 11:37   ` tip-bot2 for Shrikanth Hegde [this message]
2025-11-11 16:33   ` [tip: sched/core] sched/deadline: Use cpumask_weight_and() " tip-bot2 for Shrikanth Hegde
2025-10-15  8:41 ` [PATCH 0/2] sched/deadline: minor code cleanups Juri Lelli
2025-11-10  8:25   ` Shrikanth Hegde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=176286103469.498.8073260484561257707.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=sshegde@linux.ibm.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®