From nobody Tue Feb 10 16:18:37 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2ED7F149E0A for ; Wed, 3 Apr 2024 15:07:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712156821; cv=none; b=jN71auGUHpWPpZdJu3OaIA8E2ePdHwKwRJsC3iVwhwOOhF13xTtTaCqB/sdUxwX/rqBXLlztZKfy3Cc3oQskzk+pYyj0n+d1JstNF0bn4ctwLJR5rS2qpgL5eGmhxscIudh+rXG+VLdPSmc2rcALvGsbHwvj2NqUgmADOcDhqhc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712156821; c=relaxed/simple; bh=7a1odYqmKjFL1UduF7vAKTCHsTnZIxWKisHGINaxoB0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ra6n+9pqIaoyihtvoaUK1rjc071SMsLv7k0MUe987BEX8hlqY7JWfQNkTNTLdJTPnL3T5GmDnRRu+8TLYgR03MnUCBdlIUXwWjxtjREbeUVaLaUnFCPrC0gGmzLSKHnHHQAchVeopeF20RTvy1S3JCgwJaknHV6GPoe+Llh/bWo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AC1231691; Wed, 3 Apr 2024 08:07:30 -0700 (PDT) Received: from e126645.arm.com (unknown [10.57.74.15]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 71E283F7B4; Wed, 3 Apr 2024 08:06:55 -0700 (PDT) From: Pierre Gondois To: linux-kernel@vger.kernel.org Cc: Aaron Lu , Rui Zhang , Pierre Gondois , Anna-Maria Behnsen , Frederic Weisbecker , Ingo Molnar , Thomas Gleixner , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Waiman Long , Andrew Morton , Michal Hocko Subject: [PATCH 6/7] sched/fair: Remove on_null_domain() and redundant checks Date: Wed, 3 Apr 2024 17:05:38 +0200 Message-Id: <20240403150543.2793354-7-pierre.gondois@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240403150543.2793354-1-pierre.gondois@arm.com> References: <20240403150543.2793354-1-pierre.gondois@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" CPUs with a NULL sched domain are removed from the HKR_TYPE_SCHED isolation mask. The two following checks are equialent: - !housekeeping_runtime_test_cpu(cpu, HKR_TYPE_SCHED) - on_null_domain(rq) Remove on_null_domain() and the redundant checks. Signed-off-by: Pierre Gondois --- kernel/sched/fair.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 3e0f2a0f153f..9657c8f2176b 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -11830,11 +11830,6 @@ static void sched_balance_domains(struct rq *rq, e= num cpu_idle_type idle) =20 } =20 -static inline int on_null_domain(struct rq *rq) -{ - return unlikely(!rcu_dereference_sched(rq->sd)); -} - #ifdef CONFIG_NO_HZ_COMMON /* * NOHZ idle load balancing (ILB) details: @@ -12040,7 +12035,7 @@ void nohz_balance_exit_idle(struct rq *rq) SCHED_WARN_ON(rq !=3D this_rq()); =20 /* If we're a completely isolated CPU, we don't play: */ - if (on_null_domain(rq)) + if (!housekeeping_runtime_test_cpu(cpu_of(rq), HKR_TYPE_SCHED)) return; =20 if (likely(!rq->nohz_tick_stopped)) @@ -12090,12 +12085,8 @@ void nohz_balance_enter_idle(int cpu) */ rq->has_blocked_load =3D 1; =20 - /* Spare idle load balancing on CPUs that don't want to be disturbed: */ - if (!housekeeping_runtime_test_cpu(cpu, HKR_TYPE_SCHED)) - return; - /* If we're a completely isolated CPU, we don't play: */ - if (on_null_domain(rq)) + if (!housekeeping_runtime_test_cpu(cpu, HKR_TYPE_SCHED)) return; =20 /* @@ -12504,11 +12495,14 @@ static __latent_entropy void sched_balance_softir= q(struct softirq_action *h) */ void sched_balance_trigger(struct rq *rq) { + int cpu =3D cpu_of(rq); + /* * Don't need to rebalance while attached to NULL domain or * runqueue CPU is not active */ - if (unlikely(on_null_domain(rq) || !cpu_active(cpu_of(rq)))) + if (unlikely(!housekeeping_runtime_test_cpu(cpu, HKR_TYPE_SCHED)) || + !cpu_active(cpu)) return; =20 if (time_after_eq(jiffies, rq->next_balance)) --=20 2.25.1