From patchwork Fri Nov 23 21:48:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael Wysocki X-Patchwork-Id: 1797301 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id CB8263FC23 for ; Fri, 23 Nov 2012 21:43:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756628Ab2KWVnm (ORCPT ); Fri, 23 Nov 2012 16:43:42 -0500 Received: from ogre.sisk.pl ([193.178.161.156]:35405 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756501Ab2KWVnl (ORCPT ); Fri, 23 Nov 2012 16:43:41 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by ogre.sisk.pl (Postfix) with ESMTP id 5BC841A981F; Fri, 23 Nov 2012 22:21:55 +0100 (CET) Received: from ogre.sisk.pl ([127.0.0.1]) by localhost (ogre.sisk.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 21294-07; Fri, 23 Nov 2012 22:21:45 +0100 (CET) Received: from vostro.rjw.lan (aavl60.neoplus.adsl.tpnet.pl [83.6.45.60]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ogre.sisk.pl (Postfix) with ESMTP id B81B91DF9FB; Fri, 23 Nov 2012 22:21:45 +0100 (CET) From: "Rafael J. Wysocki" To: Andreas Schwab Cc: cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, Fabio Baltieri , Viresh Kumar Subject: Re: [PATCH] cpufreq: fix jiffies/cputime mixup in conservative/ondemand governors Date: Fri, 23 Nov 2012 22:48:12 +0100 Message-ID: <4686564.n70P6BrGFi@vostro.rjw.lan> User-Agent: KMail/4.9.3 (Linux/3.7.0-rc6; KDE/4.9.3; x86_64; ; ) In-Reply-To: <6739224.35DjQmzyyR@vostro.rjw.lan> References: <6739224.35DjQmzyyR@vostro.rjw.lan> MIME-Version: 1.0 X-Virus-Scanned: amavisd-new at ogre.sisk.pl using MkS_Vir for Linux Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org On Friday, October 26, 2012 11:10:10 PM Rafael J. Wysocki wrote: > On Friday, October 26, 2012 02:26:34 PM Andreas Schwab wrote: > > "Rafael J. Wysocki" writes: > > > > > http://git.kernel.org/?p=linux/kernel/git/rafael/linux-pm.git;a=shortlog;h=refs/heads/linux-next > > > > 91f347c looks good, unfortunately d7d6f64 undoes the change. > > I didn't notice that, sorry. Thanks for the heads up. So, I'm going to apply the following patch to fix this again. Thanks, Rafael Reviewed-by: Viresh Kumar --- From: Rafael J. Wysocki Subject: cpufreq: governors: Fix jiffies/cputime mixup (revisited) This change was made by commit 8636fd2 (cpufreq: fix jiffies/cputime mixup in conservative/ondemand governors) before, but then it has been reverted inadvertently by commit 4471a34 (cpufreq: governors: remove redundant code). The changelog of commit 8636fd2 says: The function get_cpu_idle_time_jiffy in both the conservative and ondemand governors use jiffies_to_usecs to convert a cputime value to usecs which gives the wrong value on architectures where cputime and jiffies use different units. Only matters if NO_HZ is disabled, since otherwise get_cpu_idle_time_us should already return a valid value, and get_cpu_idle_time_jiffy isn't actually called. Since now we have only one common get_cpu_idle_time_jiffy() used by both governors in question, modify it along the lines of commit 8636fd2 to restore the correct behavior. Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/cpufreq_governor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Index: linux/drivers/cpufreq/cpufreq_governor.c =================================================================== --- linux.orig/drivers/cpufreq/cpufreq_governor.c +++ linux/drivers/cpufreq/cpufreq_governor.c @@ -45,9 +45,9 @@ static inline u64 get_cpu_idle_time_jiff idle_time = cur_wall_time - busy_time; if (wall) - *wall = jiffies_to_usecs(cur_wall_time); + *wall = cputime_to_usecs(cur_wall_time); - return jiffies_to_usecs(idle_time); + return cputime_to_usecs(idle_time); } u64 get_cpu_idle_time(unsigned int cpu, u64 *wall)