Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1669615ybb; Thu, 9 Apr 2020 06:53:52 -0700 (PDT) X-Google-Smtp-Source: APiQypIHu0xLajTuIejQ3yWOojiOX+3ZgeaCEmo5LPoo+/DqUqvJXOS00wvltUpzvbXVbIvm3fJ1 X-Received: by 2002:aed:2744:: with SMTP id n62mr5112547qtd.112.1586440432093; Thu, 09 Apr 2020 06:53:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586440432; cv=none; d=google.com; s=arc-20160816; b=Jb/WkGz99MbEiI3ICae6DolE7MsBKlIhIJoAUVQAnNEUw8/w8xg+FmlBrqqilHPnUr YUJEgAdRWKCrr1c6nGGVBLlQrCmTckMGYVIREexUVyCl+DYqTuFZQoUsev9CEx7WctSs 31cZqshBU1oKp5B2/96Br4X1lj+yG5uecM6x/UiIQLyajZZoEllIz1Fo5eqw3WW/QQYc 4wkNh7uPWyYbUigpV/iKpyyGDKuUsNgXXHTdNPBBoNy2wUkXA7f1c9bQVDnbbApr/6Cv 5k6PNs8wuRiJErt+MhqrRrnUUaShDCgpYw3WpwuxIr8HVnWVMux7AtiZEIoIk4wT91CF F2xA== 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=r/F+FCyu48n4SAehU2Oy556T0LaXunxqabB85D1tY2w=; b=zEEJsD+NfGkg2qb//2T9qEdtwR0UvevW1YwhdVnJuIN+qSqTg2OttlnOXrhtAAszAn 4qsfMjxnWhMz1B93Bp+1ZLJJkAFUCF97wY/+zJUL/05/bp44hEwIF7rqqqkdxuJ4rQMQ OzwmM5voLYIFnX1gsX0naMO8Ft48OM7q+LgH23Vr1o4aZ0+D5sKGIopQqkHR0hSWJJiz ugZHo+MXQifV7mWs5Qpo6l+j3+SUy6xk1mXvo3BkuXZOkiF7ceXvsoGhaltAZuRMv2bm GzPCn1BSThAi/EZYjAtUVLdWh8LvPmfSZ2AoZO2t3/UmTFaIuUyHnyPplkrbLlmqF9OC ap1A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p67si5946801qke.51.2020.04.09.06.53.36; Thu, 09 Apr 2020 06:53:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726965AbgDINuP (ORCPT + 99 others); Thu, 9 Apr 2020 09:50:15 -0400 Received: from foss.arm.com ([217.140.110.172]:50404 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726597AbgDINuP (ORCPT ); Thu, 9 Apr 2020 09:50:15 -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 9CB7730E; Thu, 9 Apr 2020 06:50:15 -0700 (PDT) Received: from [192.168.1.19] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7525A3F68F; Thu, 9 Apr 2020 06:50:12 -0700 (PDT) Subject: Re: [PATCH 1/4] sched/topology: Store root domain CPU capacity sum To: Vincent Guittot Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , 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 References: <20200408095012.3819-1-dietmar.eggemann@arm.com> <20200408095012.3819-2-dietmar.eggemann@arm.com> <42cc3878-4c57-96ba-3ebd-1b4d4ef87fae@arm.com> From: Dietmar Eggemann Message-ID: Date: Thu, 9 Apr 2020 15:50:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: 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 08.04.20 19:03, Vincent Guittot wrote: > On Wed, 8 Apr 2020 at 18:31, Dietmar Eggemann wrote: >> >> On 08.04.20 14:29, Vincent Guittot wrote: >>> On Wed, 8 Apr 2020 at 11:50, Dietmar Eggemann wrote: >> >> [...] >> >>>> /** >>>> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c >>>> index 8344757bba6e..74b0c0fa4b1b 100644 >>>> --- a/kernel/sched/topology.c >>>> +++ b/kernel/sched/topology.c >>>> @@ -2052,12 +2052,17 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att >>>> /* Attach the domains */ >>>> rcu_read_lock(); >>>> for_each_cpu(i, cpu_map) { >>>> + unsigned long cap = arch_scale_cpu_capacity(i); >>> >>> Why do you replace the use of rq->cpu_capacity_orig by >>> arch_scale_cpu_capacity(i) ? >>> There is nothing about this change in the commit message >> >> True. And I can change this back. >> >> It seems though that the solution is not sufficient because of the >> 'rd->span &nsub cpu_active_mask' issue discussed under patch 2/4. >>ap >> But this remind me of another question I have. >> >> Currently we use arch_scale_cpu_capacity() more often (16 times) than >> capacity_orig_of()/rq->cpu_capacity_orig . >> >> What's hindering us to remove rq->cpu_capacity_orig and the code around >> it and solely rely on arch_scale_cpu_capacity()? I mean the arch >> implementation should be fast. > > Or we can do the opposite and only use capacity_orig_of()/rq->cpu_capacity_orig. > > Is there a case where the max cpu capacity changes over time ? So I > would prefer to use cpu_capacity_orig which is a field of scheduler > instead of always calling an external arch specific function I see. So far it only changes during startup. And it looks like that asym_cpu_capacity_level() [topology.c] would fail if we would use capacity_orig_of() instead of arch_scale_cpu_capacity(). post_init_entity_util_avg() [fair.c] and sugov_get_util() [cpufreq_schedutil.c] would be temporarily off until update_cpu_capacity() has updated cpu_rq(cpu)->cpu_capacity_orig. compute_energy() [fair.c] is guarded by sched_energy_enabled() from being used at startup. scale_rt_capacity() could be changed in case we call it after the cpu_rq(cpu)->cpu_capacity_orig = arch_scale_cpu_capacity(cpu) in update_cpu_capacity(). The Energy Model (and CPUfreq cooling) code would need capacity_orig_of() exported. arch_scale_cpu_capacity() currently is exported via include/linux/sched/topology.h. I guess Pelt and 'scale invariant Deadline bandwidth enforcement' should continue using arch_scale_cpu_capacity() in sync with arch_scale_freq_capacity(). IMHO it's hard to give clear advice when to use the one or the other. We probably don't want to set cpu_rq(cpu)->cpu_capacity_orig in the arch cpu scale setter. We have arch_scale_cpu_capacity() to decouple that.