Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2789543lqz; Wed, 3 Apr 2024 08:39:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVVYzMVUYzmY1n8yMeV+VOUgmveQYCOQOaZYgUJdXl21qzKN0Zpz8IIEYg7fTCTiEQy7TnBI2Xzrl874kF2PQw8zE4GSx1O8+85Vew79A== X-Google-Smtp-Source: AGHT+IEPfwG5uM6ZmF7kyMOFMngfqfbhTKqN8LUqEFEAGhwSkbU+gtCYi5GzKvoU1EtNOfLI2USr X-Received: by 2002:a17:90a:c386:b0:2a2:21f5:23be with SMTP id h6-20020a17090ac38600b002a221f523bemr11870254pjt.7.1712158772930; Wed, 03 Apr 2024 08:39:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712158772; cv=pass; d=google.com; s=arc-20160816; b=tZJSE/7xCMtV2A+jz7/XSzI6a2ta/JZx3vMvWOKxdtPKBGLeUKDRiH+HczqhFsWIZ8 x5mYHtL7QrxTq2PesZUQ4tCOERltK6quzNwlylHzYhfaiArvOnhr/XzCAS38ucIAnkNI +3yJj6YOiFxlWVdTJt3rWubGGob7iqH1SRAhBxCe15TOnQoKIDQFH4zhYfLSBLcLPV1t fgb3rl2uoRX0JSvSohGhgwxaUJyA+nCVkr53ZkN+Z4FaWE0TgZzcE9AEKvv7+v9pUqrt xXAPr1hKSGcA2AG2rxfORh1VoIgir2d9Jbc12YJJjkZD3ClODps8E715W1cQ9mAvkYoz 8x/A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=CBJPi9TFv64eSFSmHNiXAE0wVOuCSLjijCMOXCDH61s=; fh=fw7Mwziv5jjSqTBWC5+iAT+SkGhTlUlOBlMSXT83v/Y=; b=Z1yORyrlGdDLf4IevbKQcNXl/jop8eLhbvX00mN9OedpcYcHOaBm68epP1xu8E5UPa 9YdBm5bTNxhy1K0erHh+ihapJBBiImVicks+7Fxp+EVxz0UbwdpsioB7uIxFQ6ISxwO1 ZtjnAjTsn005rekhM+CRVVv8ALA0TwO+PVaj1RRrlXVabO5MPELI71osdqtRnyYq40zj JdN779RAvN/btJ8NUYQdd24D99armCG1ZgaYWm3BUVFsHf00YZ8wHjYWowW+cpmFGonK t+VoMNr2rSKCMFyGR3ZCK/aCxxxCgz+vzfm8VlTAuHP2YRjYZhLv2OIw90Q0hlqT0BmE fsGA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-130039-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130039-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id z7-20020a17090a66c700b0029dfbdc8161si15585230pjl.176.2024.04.03.08.39.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 08:39:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130039-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-130039-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130039-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id BBF10B2C943 for ; Wed, 3 Apr 2024 15:08:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B8BE14A4CF; Wed, 3 Apr 2024 15:07:02 +0000 (UTC) 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: 8bit 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, enum cpu_idle_type idle) } -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 != this_rq()); /* 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; if (likely(!rq->nohz_tick_stopped)) @@ -12090,12 +12085,8 @@ void nohz_balance_enter_idle(int cpu) */ rq->has_blocked_load = 1; - /* 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; /* @@ -12504,11 +12495,14 @@ static __latent_entropy void sched_balance_softirq(struct softirq_action *h) */ void sched_balance_trigger(struct rq *rq) { + int cpu = 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; if (time_after_eq(jiffies, rq->next_balance)) -- 2.25.1