Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp827827ybz; Fri, 1 May 2020 09:14:46 -0700 (PDT) X-Google-Smtp-Source: APiQypJyt3qq2GVegCaNsEHiq7wiv19rGcQllC9StObhOthUb488vPjTFHPVfQCQw4LQSpfKD6Rg X-Received: by 2002:a05:6402:6c4:: with SMTP id n4mr4302659edy.368.1588349686367; Fri, 01 May 2020 09:14:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588349686; cv=none; d=google.com; s=arc-20160816; b=q8AgHW5L6d9v+4fjkOr/vPbg2MOYIS3zK8Cnb2Lbe4ynbZH84kqmX6rpY6tPXyj88J VhYV50rkzBNPhXwNaOT6L4zPlme8IBWnFH7a4/PpWAwejnNV74/9KDwkO4SR9xnNvEsZ k9iY6ewb1hEDytQbZrlgLmDJ7vemJCW/OC1+5JMR1YLggTlcnr6MyFSkpxmpnP23/UVB Gl4AGKQZn9SoECvbLitXndUO6GGhsIdYQCwpl85B6+Pdb4PY6SIu/ZaoqvyFK2C2oUH4 IsuAsByUn2WJ5bevrMjMPW3jJqNKr64Usxtsj+nvAQLGgIZkyOEKaVD74MmJnS7+hgTr EyaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=zys2K0iYOw47nBO7U/KLVkuv2+yPzcVlPQmXPJEPHBE=; b=d6Z4KQrnNSd5ku8yVlfrjAld3puzvjW/qTqYlACGluZJbbDqG1dFRS107bsJSJrMGo 9iKeKIIUT6WKs89r0panmhRd07SlmU45RU7tt5xc07gwl3LSJ5wdOYHrAuZbC+ymBTP1 sTgAOmr1+ku+ePSAOcBbz5/mkYAR2+ozRxC0pSOqX5OQprN92PLTW3wv2d88lsvwp+KO tZaKsQeMMfNP+r/iyEz5woXyEhbtBTVryh2OmyeSKkrzze2CJNMxA9Hv2nKTysWfpfOq Uk3LmqA/w2KkWCmbbyH/LrbLflIj+wOA4cR/7xext00WCCU7UDcdJtKPnl5bvAjLtXLO Xx0A== 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 ly8si2270296ejb.254.2020.05.01.09.14.23; Fri, 01 May 2020 09:14:46 -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 S1729796AbgEAQML (ORCPT + 99 others); Fri, 1 May 2020 12:12:11 -0400 Received: from foss.arm.com ([217.140.110.172]:43328 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728495AbgEAQMK (ORCPT ); Fri, 1 May 2020 12:12: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 DFA2E30E; Fri, 1 May 2020 09:12:09 -0700 (PDT) Received: from [192.168.0.7] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 608DF3F68F; Fri, 1 May 2020 09:12:07 -0700 (PDT) Subject: Re: [PATCH v2 2/6] sched/deadline: Optimize dl_bw_cpus() To: Pavan Kondeti 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 References: <20200427083709.30262-1-dietmar.eggemann@arm.com> <20200427083709.30262-3-dietmar.eggemann@arm.com> <20200430105514.GC19464@codeaurora.org> From: Dietmar Eggemann Message-ID: <98ba39a7-6b9a-fefe-ae2f-91fe3020b5c1@arm.com> Date: Fri, 1 May 2020 18:12:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200430105514.GC19464@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30/04/2020 12:55, Pavan Kondeti wrote: > On Mon, Apr 27, 2020 at 10:37:05AM +0200, Dietmar Eggemann wrote: [..] >> 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()? It should cover: (1) Preventing CPU hp when DL detects a possible overflow w/o the CPU: sched_cpu_deactivate() -> cpuset_cpu_inactive() -> dl_cpu_busy() -> dl_bw_cpus() [now replaced by dl_bw_capacity()]. (2) DL Admission Control in CPU HP: __sched_setscheduler() -> sched_dl_overflow() -> dl_bw_cpus() [now + -> dl_bw_capacity()] (3) In create/destroy exclusive cpusets scenarios (comment in set_cpus_allowed_dl(), although I wasn't able to provoke this so far: do_set_cpus_allowed() -> p->sched_class->set_cpus_allowed() was never called when I ran a DL testcase and create/destroy exclusive cpusets at the same time?