Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755264AbdGKHOH (ORCPT ); Tue, 11 Jul 2017 03:14:07 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:41480 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752170AbdGKHOG (ORCPT ); Tue, 11 Jul 2017 03:14:06 -0400 Date: Tue, 11 Jul 2017 08:14:01 +0100 From: Juri Lelli To: Joel Fernandes Cc: LKML , Patrick Bellasi , Andres Oportus , Dietmar Eggemann , Srinivas Pandruvada , Len Brown , "Rafael J . Wysocki" , Viresh Kumar , Ingo Molnar , Peter Zijlstra Subject: Re: [PATCH RFC v4] cpufreq: schedutil: Make iowait boost more energy efficient Message-ID: <20170711071401.475zpaqx5eyiotjy@e106622-lin> References: <20170709170826.29396-1-joelaf@google.com> <20170710105500.ef26lvurzg6ptbhq@e106622-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2369 Lines: 64 On 10/07/17 22:12, Joel Fernandes wrote: > Hi Juri, > > On Mon, Jul 10, 2017 at 3:55 AM, Juri Lelli wrote: > > Hi Joel, > > > > On 09/07/17 10:08, Joel Fernandes wrote: [...] > >> static void sugov_iowait_boost(struct sugov_cpu *sg_cpu, unsigned long *util, > >> - unsigned long *max) > >> + unsigned long *max, unsigned int flags) > >> { > >> unsigned long boost_util = sg_cpu->iowait_boost; > >> unsigned long boost_max = sg_cpu->iowait_boost_max; > >> @@ -195,7 +222,16 @@ static void sugov_iowait_boost(struct sugov_cpu *sg_cpu, unsigned long *util, > >> *util = boost_util; > >> *max = boost_max; > >> } > >> - sg_cpu->iowait_boost >>= 1; > >> + > >> + /* > >> + * Incase iowait boost just happened on this CPU, don't reduce it right > >> + * away since then the iowait boost will never increase on subsequent > >> + * in_iowait wakeups. > >> + */ > >> + if (flags & SCHED_CPUFREQ_IOWAIT && this_cpu_ptr(&sugov_cpu) == sg_cpu) > >> + return; > >> + > >> + sugov_decay_iowait_boost(sg_cpu); > > > > Mmm, do we need to decay even when we are computing frequency requests > > for a domain? > > > > Considering it a per-cpu thing, isn't enough that it gets bumped up or > > decayed only when a CPU does an update (by using the above from > > sugov_update_shared)? > > > > If we go this way I think we will only need to reset prev_iowait_boost > > if delta_ns > TICK_NSEC during the for_each_cpu() loop of sugov_next_ > > freq_shared(). > > > > Actually the "decay" was already being done before (without this > patch), I am just preserving the same old behavior where we do decay. > Perhaps your proposal can be a separate match? Or did I miss something > else subtle here? > True, we are currently decaying anyway. Looking again at this path made me however think if we really need to. I guess we need currently, as we bump frenquency to max and then decay it. But, with your changes, I was wondering if we can simplify the thing and decay only on the per-CPU update path. The other reason for trying to simplify this is that I don't particularly like adding and consuming flags argument at this point, but I guess we could refactor the code if this is really a problem. Thanks, - Juri