From patchwork Tue Jan 6 15:39:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 42785 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 34DE52055F for ; Tue, 6 Jan 2015 15:40:35 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id gd6sf13272258lab.0 for ; Tue, 06 Jan 2015 07:40:34 -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=Oz9tImYXd+6jH8YOeQ5FvMYkVxe7qj8lVbOETDlLbvo=; b=mDLpLg5MjxX0E6z/Wm02b7mx/x7pvF0Zje1xPoeatKN1+13DglDNz4im2e2S9rAPwh cB4TkKm3CuYur3OI4KI1xYHSRv9jnOaYRyRUBbVxAg6zaIMewNI903xxp4mYpwSgITNG +j3A5XVYxfN7dSypH7JwYe6/iIzRA3vw+ptSz1n6+9lQLUGLBA3fLPE8Lwrj8fCRWyl5 xahr2Lnckp9n4LIWSGES6lVJZm0Jjl2LSU3fafhokN1Y0DpZv9QZIbD2LLLc6dhrulxD AhCjuxPaYC/wcfXFt5MkumS7fPy3bdlGTfenUIX02amdOiOw6p1NuJKxDCkOkOvoJnqU nxcg== X-Gm-Message-State: ALoCoQmhfUKayETXAPVpkduddkevItZarOMalyiOPTwhqgDXj4tZ6MRyw+O89i1dyzf5jS1QW9YV X-Received: by 10.112.188.199 with SMTP id gc7mr1613527lbc.6.1420558834156; Tue, 06 Jan 2015 07:40:34 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.28.67 with SMTP id z3ls58642lag.2.gmail; Tue, 06 Jan 2015 07:40:34 -0800 (PST) X-Received: by 10.112.162.226 with SMTP id yd2mr100840209lbb.1.1420558833992; Tue, 06 Jan 2015 07:40:33 -0800 (PST) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id cr10si66381900lad.33.2015.01.06.07.40.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 Jan 2015 07:40:33 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by mail-lb0-f182.google.com with SMTP id u10so1111000lbd.41 for ; Tue, 06 Jan 2015 07:40:33 -0800 (PST) X-Received: by 10.112.170.36 with SMTP id aj4mr100156017lbc.3.1420558833897; Tue, 06 Jan 2015 07:40:33 -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.9.200 with SMTP id c8csp1209712lbb; Tue, 6 Jan 2015 07:40:33 -0800 (PST) X-Received: by 10.66.66.196 with SMTP id h4mr155120202pat.127.1420558831472; Tue, 06 Jan 2015 07:40:31 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r11si89605937pdl.210.2015.01.06.07.40.30; Tue, 06 Jan 2015 07:40:31 -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 S1755511AbbAFPk0 (ORCPT + 12 others); Tue, 6 Jan 2015 10:40:26 -0500 Received: from mail-pd0-f173.google.com ([209.85.192.173]:46060 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755479AbbAFPkZ (ORCPT ); Tue, 6 Jan 2015 10:40:25 -0500 Received: by mail-pd0-f173.google.com with SMTP id ft15so30542758pdb.18 for ; Tue, 06 Jan 2015 07:40:25 -0800 (PST) X-Received: by 10.70.124.200 with SMTP id mk8mr158396385pdb.147.1420558825295; Tue, 06 Jan 2015 07:40:25 -0800 (PST) Received: from localhost ([122.167.212.196]) by mx.google.com with ESMTPSA id gl6sm18568759pbc.26.2015.01.06.07.40.24 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 06 Jan 2015 07:40:24 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, prarit@redhat.com, skannan@codeaurora.org, Viresh Kumar Subject: [PATCH V3 15/16] cpufreq: stats: don't update stats on false notifiers Date: Tue, 6 Jan 2015 21:09:14 +0530 Message-Id: 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.217.182 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: , We need to call cpufreq_stats_update() to update 'time_in_state' for the last frequency. This is achieved by calling it from cpufreq_stat_notifier_trans(), which is called after frequency transition. But if we detect that the cpu's frequency haven't really changed and its a false POSTCHANGE notification, we don't really need to update time_in_state. It wouldn't cause any harm in calling cpufreq_stats_update() but we can avoid calling it here and call it when the frequency really changes. The result will be the same but more efficient. Reviewed-by: Prarit Bhargava 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 6e87dd9c4083..71fcc7c198a1 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c @@ -289,11 +289,11 @@ static int cpufreq_stat_notifier_trans(struct notifier_block *nb, if (old_index == -1 || new_index == -1) return 0; - cpufreq_stats_update(stats); - if (old_index == new_index) return 0; + cpufreq_stats_update(stats); + spin_lock(&cpufreq_stats_lock); stats->last_index = new_index; #ifdef CONFIG_CPU_FREQ_STAT_DETAILS