Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp566776ybk; Wed, 20 May 2020 06:45:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsrVOVShePB55EgCqkI+KYfL11ND2bNyFGRTDYEazxMGBik0LvrKz6LB/dVstOApDGAsM2 X-Received: by 2002:a50:870c:: with SMTP id i12mr3636019edb.258.1589982302012; Wed, 20 May 2020 06:45:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589982302; cv=none; d=google.com; s=arc-20160816; b=zckqKNgssFs3NfydXJ4woxokkL20hF0I4J2KDu4q3qen17uMZZDNVCu4jF1rBBizg1 ByIvsh+O2/4/ZQHSC1ckwrlf8DMUwpsqMEsazV8qMoUaANjvdJ+dC1NOxG+AQ1/v+DrP 2XLK5Q0JPrZu/sN5wpRSq/9CStVT2ur1ZdiiICBOz3NRluIAaBkQ+cBOvBTjOU9qiCzv YAif2L89sTRayMEHLPeb/g4gkiaVVFl0e7AevliIsfmlM8qceXoSjAo5zJIVw5ONGvlg bhbDQqVQt8zVoc+TQjiWMdbKiNXT2iBRrLEz4aCLuhrGY/mbU7YXWPhzvpz85Z893kcT CJvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=iMgv3kLM7vIJI6c9TrVIVrdZBmwrNbVtoB0/OmADBWw=; b=csz407O9lEtjPRulhYgaefFPJxC5WDfyYIlya3oiHy6uj/F1/gjxcSu6A++SC7nbQK oitLtfUcGgkSJpVdUo+iGhLqaPdnCpBd0AovKSHGMGNHz+rX8bqEON8bTcMOVIGsx3gg s7TybUfWFC8mN9i7E8jIzcOuwQ4Uw4ESchsQncJUDi2lOeSUTYYCyh/85D+gW/p/lKzP cEABW8WgJ2x8thpStq5H1rRckuBRjm0ZedQOFu7doauCJTJJXyVU5SumF51wmA1lYtUf nDl6SIa0238YOwbH4A03HJqW8xY7O+eAHTHM6gDomJZkSyCQVSO9vJzWAMpjCBkJLVRe Yh6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u1si1706269ejz.492.2020.05.20.06.44.38; Wed, 20 May 2020 06:45:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726818AbgETNnM (ORCPT + 99 others); Wed, 20 May 2020 09:43:12 -0400 Received: from foss.arm.com ([217.140.110.172]:56500 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726439AbgETNnK (ORCPT ); Wed, 20 May 2020 09:43:10 -0400 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 68AC4D6E; Wed, 20 May 2020 06:43:10 -0700 (PDT) Received: from dell3630.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 72E593F52E; Wed, 20 May 2020 06:43:07 -0700 (PDT) From: Dietmar Eggemann To: Ingo Molnar , Peter Zijlstra , Juri Lelli Cc: Vincent Guittot , Steven Rostedt , Luca Abeni , Daniel Bristot de Oliveira , Wei Wang , Quentin Perret , Alessio Balsini , Pavan Kondeti , Patrick Bellasi , Morten Rasmussen , Valentin Schneider , Qais Yousef , linux-kernel@vger.kernel.org Subject: [PATCH v3 1/5] sched/deadline: Optimize dl_bw_cpus() Date: Wed, 20 May 2020 15:42:39 +0200 Message-Id: <20200520134243.19352-2-dietmar.eggemann@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200520134243.19352-1-dietmar.eggemann@arm.com> References: <20200520134243.19352-1-dietmar.eggemann@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return the weight of the root domain (rd) span in case it is a subset of the cpu_active_mask. Continue to compute the number of CPUs over rd span and cpu_active_mask when in hotplug. Signed-off-by: Dietmar Eggemann --- kernel/sched/deadline.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 504d2f51b0d6..4ae22bfc37ae 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -54,10 +54,16 @@ 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 = 0; + 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++; -- 2.17.1