From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753005AbdJ3MHP (ORCPT ); Mon, 30 Oct 2017 08:07:15 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:52758 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751810AbdJ3MHN (ORCPT ); Mon, 30 Oct 2017 08:07:13 -0400 X-Google-Smtp-Source: ABhQp+TmGWAkNOyB6DhGZ0c0jD/mzs9zOuOxJAUJ2m4dJAERTgs1U5KCoGQiJPuxaUUHNDPNMbu06A== Date: Mon, 30 Oct 2017 17:37:09 +0530 From: Viresh Kumar To: Joel Fernandes Cc: linux-kernel@vger.kernel.org, "Rafael J . Wysocki" , Ingo Molnar , Peter Zijlstra , "Cc: Srinivas Pandruvada" , "Cc: Len Brown" , "Cc: Juri Lelli" , "Cc: Patrick Bellasi" , "Cc: Steve Muckle" , "Cc: Brendan Jackman" , "Cc: Chris Redpath" , "Cc: Atish Patra" , "Cc: Dietmar Eggemann" , "Cc: Vincent Guittot" , "Cc: Morten Ramussen" , "Cc: Frederic Weisbecker" , "Cc: Thomas Gleixner" , "Cc: EAS Dev" , "Cc: Android Kernel" Subject: Re: [PATCH RFC 2/5] sched/fair: Skip frequency update if CPU about to idle Message-ID: <20171030120709.GO4240@vireshk-i7> References: <20171028095941.4773-1-joelaf@google.com> <20171028095941.4773-3-joelaf@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171028095941.4773-3-joelaf@google.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28-10-17, 02:59, Joel Fernandes wrote: > Updating CPU frequency on last dequeue of a CPU is useless. Because the > utilization since CPU came out of idle can increase till the last dequeue, this > means we are requesting for a higher frequency before entering idle which is > not very meaningful or useful. It causes unwanted wakeups of the schedutil > governor kthread in slow-switch systems resulting in large number of wake ups > that could have been avoided. In an Android application playing music where the > music app's thread wakes up and sleeps periodically on an Android device, its > seen that the frequency increases slightly on the dequeue and is reduced when > the task wakes up again. This oscillation continues between 300Mhz and 350Mhz, > and while the task is running, its at 300MHz the whole time. This is pointless. > Adding to that, these are unnecessary wake ups. Infact most of the time when > the sugov thread wakes up, all the CPUs are idle - so it can hurt power by > disturbing the cluster when it is idling. > > This patch prevents a frequency update on the last dequeue. With this the > number of schedutil governor thread wake ups are reduces more than 2 times > (1389 -> 527). > > Cc: Rafael J. Wysocki > Cc: Viresh Kumar > Cc: Ingo Molnar > Cc: Peter Zijlstra > Signed-off-by: Joel Fernandes > --- > kernel/sched/fair.c | 25 ++++++++++++++++++++++--- > kernel/sched/sched.h | 1 + > 2 files changed, 23 insertions(+), 3 deletions(-) So you are doing this only for CFS, isn't that required for RT/DL as well? Also, this more looks like a policy decision. Will it be better to put that directly into schedutil? Like this: if (cpu_idle()) "Don't change the freq"; Will something like that work? -- viresh