From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757910AbcEFGbD (ORCPT ); Fri, 6 May 2016 02:31:03 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:34575 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751748AbcEFGbA (ORCPT ); Fri, 6 May 2016 02:31:00 -0400 Date: Fri, 6 May 2016 12:00:56 +0530 From: Viresh Kumar To: "Rafael J. Wysocki" Cc: Linux PM list , Linux Kernel Mailing List , Chen Yu , Timo Valtoaho Subject: Re: [PATCH] cpufreq: governor: Fix handling of special cases in dbs_update() Message-ID: <20160506063056.GC24109@vireshk-i7> References: <4149261.sebfWj8seH@vostro.rjw.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4149261.sebfWj8seH@vostro.rjw.lan> 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 06-05-16, 01:30, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > As reported in KBZ 69821: > > "With CONFIG_HZ_PERIODIC=y cpu stays at the lowest frequcency 800MHz > even if usage goes to 100%, frequency does not scale up, the governor > in use is ondemand. Neither works conservative. Performance and > userspace governors work as expected. > > With CONFIG_NO_HZ_IDLE or CONFIG_NO_HZ_FULL cpu scales up with ondemand > as expected." > > Analysis carried out by Chen Yu leads to the conclusion that the > observed issue is due to idle_time in dbs_update() representing a > negative number in which case the function will return 0 as the load > (unless load is greater than 0 for another CPU sharing the policy), > although that need not be the right choice. > > Indeed, idle_time representing a negative number means that during > the last sampling interval the CPU was almost 100% busy on the rough > average, so 100 should be returned as the load in that case. > > Modify the code accordingly and rearrange it to clarify the handling > of all of the special cases in it. While at it, also avoid returning > zero as the load if time_elapsed is 0 (it doesn't really make sense > to return 0 then). > > Link: https://bugzilla.kernel.org/show_bug.cgi?id=69821 > Tested-by: Chen Yu > Tested-by: Timo Valtoaho > Signed-off-by: Rafael J. Wysocki > --- > drivers/cpufreq/cpufreq_governor.c | 87 +++++++++++++++++++++---------------- > 1 file changed, 51 insertions(+), 36 deletions(-) Acked-by: Viresh Kumar -- viresh