Received: by 10.213.65.68 with SMTP id h4csp3945650imn; Tue, 10 Apr 2018 07:02:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx486+KYqU6IHP+0iX6nUiherkL9Pf93i0MnLy7SYTi4je93mzyVGqNSxs7up1qWdugwqbJqK X-Received: by 2002:a17:902:6a81:: with SMTP id n1-v6mr590266plk.342.1523368933160; Tue, 10 Apr 2018 07:02:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523368933; cv=none; d=google.com; s=arc-20160816; b=pqDEMtCs/+tRXIk6v+Go+RFVrdw3z8K7Yzq9DamQxb+ou3gqXHKL5mhhaux7hZliOD BCrYSWaSduJnQhPifPtOW3CpbhklP4jlVAz8TJr8hWXJYDjMP+SJOImugeoVnnmYqaty i3jYxaPtJ7vnSLsEiioW1r9IEoBMxBs5hvsS5ycr3YoTPDMT+ngNxKrqBORn/WriIACz Pdr8xa5oxPirjSuJc2wMIlzRXDEMUWGNsgk8GxEY3uKI+qmvMxZqT0GIfkek5+J8USWH Ne9EWGN3j6Dk25ihGT3XZJ9dcjem37t3do0Q+VYn5hU4bzaszFGbTb4wTsDPJR7sxLpk d7kg== 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:arc-authentication-results; bh=tG/OVs4d9vYQy9otdxqzxNkFQNrkxn+SlkTec2hVYi8=; b=ufpkWYm1mMEOSafYDAeogZm8p5iiawZwDyR0LuamN0QklVvyGu7MCFb1s/l8BigEhj WUSwRp/MdDleHyRze0nAw+93vBOolJasZC4RT8hviHnqVYYWYPekK3u+gUnLBGgaYHLE ZmQEigEr0Fx7xprpbUIlGKDcrg8SGaMqdLULeMQ4p7W2fZ37om/t2Ki2bPhdI6p5u+rQ vrHBBr1Rjn+KrqgwRk4fL35+uRL/IMBDIW05Jv8Sx72WXwzSJeM3xhnI8VdwcV5vD4SG 3a8Nv0ncrAxldYqkYZWbFCb/KfAlJhsIk+/f9C2/07nFtTkRuYAlH9deSW5I7qTG/hcA KNmA== 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 b3-v6si2713611plc.329.2018.04.10.07.01.27; Tue, 10 Apr 2018 07:02:13 -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 S1754059AbeDJN4r (ORCPT + 99 others); Tue, 10 Apr 2018 09:56:47 -0400 Received: from foss.arm.com ([217.140.101.70]:38696 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753900AbeDJN4q (ORCPT ); Tue, 10 Apr 2018 09:56:46 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AE83080D; Tue, 10 Apr 2018 06:56:45 -0700 (PDT) Received: from e108498-lin.cambridge.arm.com (e108498-lin.cambridge.arm.com [10.1.210.38]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BDD643F587; Tue, 10 Apr 2018 06:56:42 -0700 (PDT) Date: Tue, 10 Apr 2018 14:56:41 +0100 From: Quentin Perret To: Peter Zijlstra Cc: Dietmar Eggemann , linux-kernel@vger.kernel.org, Thara Gopinath , linux-pm@vger.kernel.org, Morten Rasmussen , Chris Redpath , Patrick Bellasi , Valentin Schneider , "Rafael J . Wysocki" , Greg Kroah-Hartman , Vincent Guittot , Viresh Kumar , Todd Kjos , Joel Fernandes , Juri Lelli , Steve Muckle , Eduardo Valentin Subject: Re: [RFC PATCH v2 4/6] sched/fair: Introduce an energy estimation helper function Message-ID: <20180410135640.GB3866@e108498-lin.cambridge.arm.com> References: <20180406153607.17815-1-dietmar.eggemann@arm.com> <20180406153607.17815-5-dietmar.eggemann@arm.com> <20180410125105.GC4043@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180410125105.GC4043@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 10 Apr 2018 at 14:51:05 (+0200), Peter Zijlstra wrote: > On Fri, Apr 06, 2018 at 04:36:05PM +0100, Dietmar Eggemann wrote: > > +static inline > > +struct capacity_state *find_cap_state(int cpu, unsigned long util) > > +{ > > + struct sched_energy_model *em = *per_cpu_ptr(energy_model, cpu); > > + struct capacity_state *cs = NULL; > > + int i; > > + > > + util += util >> 2; > > + > > + for (i = 0; i < em->nr_cap_states; i++) { > > + cs = &em->cap_states[i]; > > + if (cs->cap >= util) > > + break; > > + } > > + > > + return cs; > > +} > > So in the last thread there was some discussion about this; in > particular on how this related to schedutil and if we should tie it into > that. > > I think for starters tying it to schedutil is not a bad idea; ideally > people _should_ migrate towards using that. > > Also; I think it makes sense to better integrate cpufreq and the > energy-model values like what rjw already suggested, such that maybe we > can have cpufreq_driver_resolve_freq() return a structure containing the > relevant information for the selected frequency. I guess if we want to do that in the wake-up path, we would also need to add a new parameter to it to make sure we don't actually call into cpufreq_driver->resolve_freq() ... But then, we could sort of rely on cpufreq_schedutil.c::get_next_freq() to replace find_cap_state() ... Is this what you had in mind ? > > But implementing the frequency selection thing in multiple places like > now sounds like a very bad idea to me. Understood. Making sure we share the same code everywhere might have consequences though. I guess we'll have to either accept the cost of function calls in the wake-up path, or to accept to inline those functions for ex. Or maybe you had something else in mind ? Anyways, that's probably another good discussion topic for OSPM next week :-) Thanks, Quentin