Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2649592ybz; Mon, 27 Apr 2020 01:39:33 -0700 (PDT) X-Google-Smtp-Source: APiQypLZlLxrSMIrZlxU68L9dZxB11X7HeZnJiz/+ij8xR2m/jycvKiOS7TUUESnBQL0PYRjzMb0 X-Received: by 2002:a17:906:6441:: with SMTP id l1mr19213629ejn.148.1587976773130; Mon, 27 Apr 2020 01:39:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587976773; cv=none; d=google.com; s=arc-20160816; b=h/pxBSr2LpSUVHDbAnY68ifxQGONNvmrZiCYyJzon+AddgciUFgydoxLqon07IgMUY M8pF3WiLjnJE/CxpBdqJEpqtBoOJwFb7pPo97SCOry08kN2HrLmBkFOxP9Et/fBvMltp 5VtcaoX3d6JIMKWUa7k2L5VPi+zjbfjDaul9ilkF3isoI0RdvDJEd65+T3t/+VnA+YY0 0QX25re1CLYP6iiYe0KL6kScJ+rt5s/ElCP5fXHJEHKK6b/956Ghy3mM7fm6ERl91rXj s2Qb9hv2+GX00v+ZCJiNtKFuKexUSlynZ+DwECnVqFPor64KQn2yoqVi2PY7JTK5GX2l hsXQ== 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=g/yot+kS2jrLy/SfK+yQYy/w/oIhDF5Ag/5Aknt10Ug=; b=F622OrmgdH0DwgeZbKsf51gXviJUhI5fhLJa9VFqophHfPLzsJGy/31UuZoJc42dpt 3zC91jLZULio9dLupfuJNANJICGNKLr8CuIGm4Vls/RHwxOLkFpz1aJC83rpA+Z3DRuO WuVpd7c4bFHyqB0/AcFrtHKy2l7GMWKECR/JHShigFyVLByVO6zvOw1fz30Rk7yqI/Zh IXLCwof6j4hE8bdGGVDFY1jUQ6wFmcveytGw9CLUdIg/fSVMCHBYfQG6H0kPFOi+cPCR mu8OFnNgLcyW6Ta/PNsQ2/gPGYl2z9ZX0rTK/YTYI42k6TbwdDfebxH3Mjj1g3nze0WU D/KA== 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 a25si7837522ejr.32.2020.04.27.01.39.10; Mon, 27 Apr 2020 01:39:33 -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 S1726805AbgD0Ihk (ORCPT + 99 others); Mon, 27 Apr 2020 04:37:40 -0400 Received: from foss.arm.com ([217.140.110.172]:59900 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725899AbgD0Ihj (ORCPT ); Mon, 27 Apr 2020 04:37:39 -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 02AAA113E; Mon, 27 Apr 2020 01:37:39 -0700 (PDT) Received: from dell3630.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 5DA873F68F; Mon, 27 Apr 2020 01:37:35 -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 v2 2/6] sched/deadline: Optimize dl_bw_cpus() Date: Mon, 27 Apr 2020 10:37:05 +0200 Message-Id: <20200427083709.30262-3-dietmar.eggemann@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200427083709.30262-1-dietmar.eggemann@arm.com> References: <20200427083709.30262-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 rd (root domain) 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