Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1693272ybz; Thu, 30 Apr 2020 03:57:22 -0700 (PDT) X-Google-Smtp-Source: APiQypJgxNIDZ4wimHM7zarGaUISRc3TYk3Wy/5+R6jBO8Ked6LsEmy0IXaBrFId3rJ2WWqW9wi0 X-Received: by 2002:a05:6402:1adc:: with SMTP id ba28mr2043232edb.336.1588244242804; Thu, 30 Apr 2020 03:57:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588244242; cv=none; d=google.com; s=arc-20160816; b=LfJfGQX5ZRyFloHko/zCowTnbcZGiF+bM1vpa+Xf84Ds1uSKKLL1jdngC1eTN7G4CC xtVEk5NDeS+pV4hYhEtglOUxhGUIQCQRLKptPDory6a7zuLgTOXnOhfSjOqqFp/KTC2w aeDsmdb2qrqKrcFyzKowsOd+yIZKqbO4U+QYN5Yxojw4+ECDmWjqxoHVa5pDWRMY5yFs JAXWZab9tEae+U6MyGTC2Y43ddjg0LyIxgOt5h/OJgXB0Ns15gKZviOWCDvR5wW7aDec isQY5ArPXe+jMtYMrnLKakPoiRgu6svOnNShlhsjjyY23laHSuuPp07t107R0QSYUKH7 xEqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:dkim-signature; bh=OsZ/pNJ65qyQXurGQU11CbmokKkvoyDjj3d8TxgSEco=; b=sDnfH7lvexN75BF625bUtGAD0eRK5Jw7OVR249GoYMaW9xC4rB5dHEyvC3z2vw8t7g un/om2beKQdy3MzemuaJPZirdAIq4qx+tOwUFDeWEZ8aa41Tv8UP4evl+vniWGRkiD84 WgsBJke7jHp+oDTRLjqyFKbCAJRsuHAK0/M9ga+vEmQQ+Ylyp9/LacxAr2T3dO0UcOKY Kvub09y08/hWotUZPN6+/j2zBKExFq9v85kfPBGQLEP47rfRjLZX53dXdZ/CX0+mV95H HULs9WZgPgdS2cuwbsmzyCNTCmXVdrGneqrMosiA/VmmvNcokcjOWxuGjszQEcnvnyx2 eTUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=QQHZAy1f; 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 m10si5017377edr.459.2020.04.30.03.56.59; Thu, 30 Apr 2020 03:57:22 -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; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=QQHZAy1f; 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 S1726830AbgD3Kz0 (ORCPT + 99 others); Thu, 30 Apr 2020 06:55:26 -0400 Received: from mail26.static.mailgun.info ([104.130.122.26]:50542 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726413AbgD3Kz0 (ORCPT ); Thu, 30 Apr 2020 06:55:26 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1588244125; h=In-Reply-To: Content-Type: MIME-Version: References: Message-ID: Subject: Cc: To: From: Date: Sender; bh=OsZ/pNJ65qyQXurGQU11CbmokKkvoyDjj3d8TxgSEco=; b=QQHZAy1f/KkYSwBe8DVAgr+XBDgQt8MGRPzx4m0PmK13VFhP5A01uMeAIzLPbUEothlqSHPm wFsUcC5PxLPlLBHCvYJnBQZ5A/JxicgU3vIOFu2e/RB5BgrRLn4FlFLCDQb6aB+hsFOrbus5 0WzZ/sv0Ixxn2MZbdU/l5RHGBlo= X-Mailgun-Sending-Ip: 104.130.122.26 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5eaaae9d.7f090a701ae8-smtp-out-n05; Thu, 30 Apr 2020 10:55:25 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 96644C4478F; Thu, 30 Apr 2020 10:55:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from codeaurora.org (blr-c-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: pkondeti) by smtp.codeaurora.org (Postfix) with ESMTPSA id 269BEC433CB; Thu, 30 Apr 2020 10:55:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 269BEC433CB Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=pkondeti@codeaurora.org Date: Thu, 30 Apr 2020 16:25:15 +0530 From: Pavan Kondeti To: Dietmar Eggemann Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Steven Rostedt , Luca Abeni , Daniel Bristot de Oliveira , Wei Wang , Quentin Perret , Alessio Balsini , Patrick Bellasi , Morten Rasmussen , Valentin Schneider , Qais Yousef , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/6] sched/deadline: Optimize dl_bw_cpus() Message-ID: <20200430105514.GC19464@codeaurora.org> References: <20200427083709.30262-1-dietmar.eggemann@arm.com> <20200427083709.30262-3-dietmar.eggemann@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200427083709.30262-3-dietmar.eggemann@arm.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 27, 2020 at 10:37:05AM +0200, Dietmar Eggemann wrote: > 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); > + Looks good to me. This is a nice optimization. > + cpus = 0; > + > for_each_cpu_and(i, rd->span, cpu_active_mask) > cpus++; > Do you know why this check is in place? Is it only to cover the case of cpuset_cpu_inactive()->dl_cpu_busy()? Thanks, Pavan > -- > 2.17.1 > -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.