Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754837AbdGJRtm (ORCPT ); Mon, 10 Jul 2017 13:49:42 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:57102 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754689AbdGJRtk (ORCPT ); Mon, 10 Jul 2017 13:49:40 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 10 Jul 2017 10:49:39 -0700 From: Vikram Mulukutla To: Joel Fernandes Cc: Patrick Bellasi , LKML , Linux PM , Ingo Molnar , Peter Zijlstra , "Rafael J . Wysocki" , Viresh Kumar , Vincent Guittot , Juri Lelli , Andres Oportus , Todd Kjos , Morten Rasmussen , Dietmar Eggemann , linux-kernel-owner@vger.kernel.org Subject: Re: [PATCH v2 4/6] cpufreq: schedutil: update CFS util only if used In-Reply-To: References: <1499189651-18797-1-git-send-email-patrick.bellasi@arm.com> <1499189651-18797-5-git-send-email-patrick.bellasi@arm.com> Message-ID: User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2097 Lines: 58 On 2017-07-07 23:14, Joel Fernandes wrote: > Hi Vikram, > > On Thu, Jul 6, 2017 at 11:44 PM, Vikram Mulukutla > wrote: >> On 2017-07-04 10:34, Patrick Bellasi wrote: >>> >>> Currently the utilization of the FAIR class is collected before >>> locking >>> the policy. Although that should not be a big issue for most cases, >>> we >>> also don't really know how much latency there can be between the >>> utilization reading and its usage. >>> >>> Let's get the FAIR utilization right before its usage to be better in >>> sync with the current status of a CPU. >>> >>> Signed-off-by: Patrick Bellasi >> Given that the utilization update hooks are called with the per-cpu rq >> lock >> held (for all classes), I don't think PELT utilization can change >> throughout >> the lifetime of the cpufreq_update_{util,this_cpu} call? Even with >> Viresh's >> remote cpu callback series we'd still have to hold the rq lock across >> cpufreq_update_util.. what can change today is 'max' >> (arch_scale_cpu_capacity) when a cpufreq policy is shared, so the >> patch is >> still needed for that reason I think? >> > > I didn't follow, Could you elaborate more why you think the patch > helps with the case where max changes while the per-cpu rq lock held? > So going by Patrick's commit text, the concern was a TOC/TOU problem, but since we agree that CFS utilization can't change within an rq-locked critical section, the only thing that can change is 'max'. So you might be the 8th cpu in line waiting for the sg-policy lock, and after you get the lock, the max may be outdated. But come to think of it max changes should be triggering schedutil updates and those shouldn't be rate-throttled, so maybe we don't need this at all? It's still somewhat future-proof in case there is some stat that we read in sugov_get_util that can be updated asynchronously. However we can put it in when we need it... > thanks, > > -Joel -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project