From patchwork Thu Mar 30 21:36:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 9655173 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1B2FA60349 for ; Thu, 30 Mar 2017 21:42:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D74F285DA for ; Thu, 30 Mar 2017 21:42:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01CB5285E0; Thu, 30 Mar 2017 21:42:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B1336285DA for ; Thu, 30 Mar 2017 21:42:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935124AbdC3Vm3 (ORCPT ); Thu, 30 Mar 2017 17:42:29 -0400 Received: from cloudserver094114.home.net.pl ([79.96.170.134]:61490 "EHLO cloudserver094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933875AbdC3Vm1 (ORCPT ); Thu, 30 Mar 2017 17:42:27 -0400 Received: from adkt166.ipv4.supernova.orange.pl (79.184.253.166) (HELO aspire.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.82) id 5ef8c426317f11dd; Thu, 30 Mar 2017 23:42:29 +0200 From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Peter Zijlstra , Srinivas Pandruvada , Viresh Kumar , Juri Lelli , Vincent Guittot , Patrick Bellasi , Joel Fernandes , Morten Rasmussen , John Subject: [RFC/RFT][PATCH] cpufreq: schedutil: Reduce frequencies slower Date: Thu, 30 Mar 2017 23:36:41 +0200 Message-ID: <1514608.eWxQqcMBcc@aspire.rjw.lan> User-Agent: KMail/4.14.10 (Linux/4.10.0+; KDE/4.14.9; x86_64; ; ) MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rafael J. Wysocki The schedutil governor reduces frequencies too fast in some situations which cases undesirable performance drops to appear. To address that issue, make schedutil reduce the frequency slower by setting it to the average of the value chosen during the previous iteration of governor computations and the new one coming from its frequency selection formula. Link: https://bugzilla.kernel.org/show_bug.cgi?id=194963 Reported-by: John Signed-off-by: Rafael J. Wysocki Acked-by: Viresh Kumar --- This addresses a practical issue, but one in the "responsiveness" or "interactivity" category which is quite hard to represent quantitatively. As reported by John in BZ194963, schedutil does not ramp up P-states quickly enough which causes audio issues to appear in his gaming setup. At least it evidently is worse than ondemand in this respect and the patch below helps. The patch essentially repeats the trick added some time ago to the load-based P-state selection algorithm in intel_pstate, which allowed us to make it viable for performance-oriented users, and which is to reduce frequencies at a slower pace. The reason why I chose the average is because it is computationally cheap and pretty much the max reasonable slowdown and the idea is that in case there's something about to run that we don't know about yet, it is better to stay at a higher level for a while more to avoid having to get up from the floor every time. But technically speaking it is a filter. :-) So among other things I'm wondering if that leads to substantial increases in energy consumption anywhere. Thanks, Rafael --- kernel/sched/cpufreq_schedutil.c | 3 +++ 1 file changed, 3 insertions(+) Index: linux-pm/kernel/sched/cpufreq_schedutil.c =================================================================== --- linux-pm.orig/kernel/sched/cpufreq_schedutil.c +++ linux-pm/kernel/sched/cpufreq_schedutil.c @@ -101,6 +101,9 @@ static void sugov_update_commit(struct s if (sg_policy->next_freq == next_freq) return; + if (sg_policy->next_freq > next_freq) + next_freq = (sg_policy->next_freq + next_freq) >> 1; + sg_policy->next_freq = next_freq; sg_policy->last_freq_update_time = time;