From patchwork Thu Dec 18 12:00:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 42439 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0DD2926C8B for ; Thu, 18 Dec 2014 12:01:52 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id l18sf651756wgh.2 for ; Thu, 18 Dec 2014 04:01:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=WlzHV/YFB4/7nZabjU5ZTYYDAOMia4VtYCZsgli08XQ=; b=BzOsk2Z0R5Ikdysf+VgKxti9Mp0+Jh+addUdG+S437lR54RGVGfrJD9oqGGzFXSFkJ PjroVtIyj29TeDqMCRJESrE1FWWagXSD3OiOnQUTD5I1yzEdDX/sGdBfOsV+qMWpczpz +NhggplDb5Sk8hJdvP250hXORAKFFGdgxWlx1iziuDjKhMpDfwTrN6R3vZk5Q/pg40PZ YK8vOXXhr17bN/ns+QUqtcskU6pBSIHTbCl0XaAGVvlru8ImJRD3N+xO4Op2eT+Fvybl ZiR45Gp59taJy2Ug6zPp5t2a0/eSRbZI9x7zBM6gL7ZVpZLEHQyK+3WH5idCN+kUdTSq W8Zw== X-Gm-Message-State: ALoCoQnGnSeVctlWLgW3nUOcIWyKCXRcRYq77iXGKoKMT9iIvTxT1tbiJCpHL7hpmQaQ/+F2Ta9s X-Received: by 10.180.8.232 with SMTP id u8mr351383wia.7.1418904111381; Thu, 18 Dec 2014 04:01:51 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.98 with SMTP id d2ls1166290lae.19.gmail; Thu, 18 Dec 2014 04:01:51 -0800 (PST) X-Received: by 10.112.145.37 with SMTP id sr5mr1916126lbb.76.1418904111154; Thu, 18 Dec 2014 04:01:51 -0800 (PST) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id aq3si6646191lbc.78.2014.12.18.04.01.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Dec 2014 04:01:51 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by mail-la0-f50.google.com with SMTP id pn19so877009lab.9 for ; Thu, 18 Dec 2014 04:01:51 -0800 (PST) X-Received: by 10.152.2.74 with SMTP id 10mr1854678las.38.1418904111059; Thu, 18 Dec 2014 04:01:51 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.142.69 with SMTP id ru5csp1680595lbb; Thu, 18 Dec 2014 04:01:50 -0800 (PST) X-Received: by 10.66.186.110 with SMTP id fj14mr2787920pac.98.1418904109372; Thu, 18 Dec 2014 04:01:49 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ov3si9608661pbc.228.2014.12.18.04.01.46; Thu, 18 Dec 2014 04:01:49 -0800 (PST) Received-SPF: none (google.com: linux-pm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752472AbaLRMBq (ORCPT + 12 others); Thu, 18 Dec 2014 07:01:46 -0500 Received: from mail-pd0-f180.google.com ([209.85.192.180]:54905 "EHLO mail-pd0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752450AbaLRMBp (ORCPT ); Thu, 18 Dec 2014 07:01:45 -0500 Received: by mail-pd0-f180.google.com with SMTP id w10so1284858pde.25 for ; Thu, 18 Dec 2014 04:01:45 -0800 (PST) X-Received: by 10.66.241.239 with SMTP id wl15mr2781109pac.15.1418904104953; Thu, 18 Dec 2014 04:01:44 -0800 (PST) Received: from localhost ([122.166.148.73]) by mx.google.com with ESMTPSA id a6sm6605559pbu.64.2014.12.18.04.01.43 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 18 Dec 2014 04:01:44 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Viresh Kumar Subject: [PATCH 11/13] cpufreq: stats: don't update stats on false notifiers Date: Thu, 18 Dec 2014 17:30:28 +0530 Message-Id: <1345c88e4a97e7e12feaa6904ee782caa141f802.1418902789.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.2.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , No idea when 'old_index == new_index' in transition notifier (probably never?), but if this happens, we aren't supposed to update time_in_state by calling cpufreq_stats_update(). Its only relevant when we are changing frequencies. So, move the call after matching indexes. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq_stats.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index c0c2ddece8fe..7701532b32c8 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c @@ -293,11 +293,11 @@ static int cpufreq_stat_notifier_trans(struct notifier_block *nb, if (old_index == -1 || new_index == -1) return 0; - cpufreq_stats_update(stat); - if (old_index == new_index) return 0; + cpufreq_stats_update(stat); + spin_lock(&cpufreq_stats_lock); stat->last_index = new_index; #ifdef CONFIG_CPU_FREQ_STAT_DETAILS