From patchwork Mon Jun 9 05:24:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 31533 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f198.google.com (mail-pd0-f198.google.com [209.85.192.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7B01020CBB for ; Mon, 9 Jun 2014 05:24:56 +0000 (UTC) Received: by mail-pd0-f198.google.com with SMTP id w10sf6518175pde.1 for ; Sun, 08 Jun 2014 22:24:55 -0700 (PDT) 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:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=vxMmuW08GjU3G+bNdAn4w7ba+dfCSUNwPBAsW+gr47g=; b=d3mampDZ7yOz++t8L4FzxlRbsneL+JOAMc9PB/gF+cBhTwmQBiZnCifxoLrm4LNeAT HYy49n69GWze6nD9PGHD0L1vF0GsUb2eymSHq9Lztv7Xg6lxnhTn68lID5m62vBpP35D MnDphdhS2OSk6D3PHL2FVgMBDP9x5bZ+G34YMNpnIaoOngem8nS0NY2dtcFiBeHhbM+s UjArOlNUrmENqyq4HyjRdSi1ACkP/P0t9muazvEgWFDWfdc+9k2pHNXGGY6AJgBvGYvQ kGOoE3Dtwo2US1Zpvtai0S1C4ybSG343tHbq9+BrI3u1iz/QNf6DPHoKpOD3bGMy9hGX dY9A== X-Gm-Message-State: ALoCoQmz2/PwCoboLC4vFtJKWoNGAYKcW5zmlRoVt/cRwJLT5YeldYcpgunJnjBUXNhb2V7B+6VZ X-Received: by 10.66.65.142 with SMTP id x14mr1273661pas.14.1402291495685; Sun, 08 Jun 2014 22:24:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.108.4 with SMTP id i4ls1479512qgf.78.gmail; Sun, 08 Jun 2014 22:24:55 -0700 (PDT) X-Received: by 10.52.96.8 with SMTP id do8mr19817018vdb.4.1402291495547; Sun, 08 Jun 2014 22:24:55 -0700 (PDT) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id q13si10203091vci.29.2014.06.08.22.24.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 08 Jun 2014 22:24:55 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.173 as permitted sender) client-ip=209.85.128.173; Received: by mail-ve0-f173.google.com with SMTP id db11so559545veb.4 for ; Sun, 08 Jun 2014 22:24:55 -0700 (PDT) X-Received: by 10.52.110.105 with SMTP id hz9mr20336342vdb.9.1402291495447; Sun, 08 Jun 2014 22:24:55 -0700 (PDT) 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.221.54.6 with SMTP id vs6csp113472vcb; Sun, 8 Jun 2014 22:24:55 -0700 (PDT) X-Received: by 10.66.119.136 with SMTP id ku8mr2151141pab.121.1402291494692; Sun, 08 Jun 2014 22:24:54 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cl5si1104312pad.108.2014.06.08.22.24.54; Sun, 08 Jun 2014 22:24:54 -0700 (PDT) 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 S1751288AbaFIFYx (ORCPT + 13 others); Mon, 9 Jun 2014 01:24:53 -0400 Received: from mail-qg0-f41.google.com ([209.85.192.41]:35995 "EHLO mail-qg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750756AbaFIFYw (ORCPT ); Mon, 9 Jun 2014 01:24:52 -0400 Received: by mail-qg0-f41.google.com with SMTP id j5so8542016qga.0 for ; Sun, 08 Jun 2014 22:24:51 -0700 (PDT) X-Received: by 10.229.127.9 with SMTP id e9mr29511974qcs.5.1402291491434; Sun, 08 Jun 2014 22:24:51 -0700 (PDT) Received: from localhost (ec2-23-23-178-99.compute-1.amazonaws.com. [23.23.178.99]) by mx.google.com with ESMTPSA id g4sm15127010qas.48.2014.06.08.22.24.47 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 08 Jun 2014 22:24:50 -0700 (PDT) From: Viresh Kumar To: rjw@rjwysocki.net Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, arvind.chauhan@arm.com, srivatsa.bhat@linux.vnet.ibm.com, svaidy@linux.vnet.ibm.com, ego@linux.vnet.ibm.com, pavel@ucw.cz, Viresh Kumar Subject: [PATCH] cpufreq: governor: remove copy_prev_load from 'struct cpu_dbs_common_info' Date: Mon, 9 Jun 2014 10:54:17 +0530 Message-Id: X-Mailer: git-send-email 2.0.0.rc2 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.128.173 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: , 'copy_prev_load' was recently added by commit: 18b46ab (cpufreq: governor: Be friendly towards latency-sensitive bursty workloads). It actually is a bit redundant as we also have 'prev_load' which can store any integer value and can be used instead of 'copy_prev_load' by setting it to zero when we don't want to use previous load. So, drop 'copy_prev_load' and use 'prev_load' instead. Update comments as well to make it more clear. There is another change here which was probably missed by Srivatsa during the last version of updates he made. The unlikely in the 'if' statement was covering only half of the condition and the whole line should actually come under it. Also checkpatch is made more silent as it was reporting this (--strict option): CHECK: Alignment should match open parenthesis + if (unlikely(wall_time > (2 * sampling_rate) && + j_cdbs->prev_load)) { Signed-off-by: Viresh Kumar Acked-by: Pavel Machek --- drivers/cpufreq/cpufreq_governor.c | 13 ++++++++----- drivers/cpufreq/cpufreq_governor.h | 8 ++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index 9004450..a1ad804 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c @@ -132,14 +132,18 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu) * an unusually large 'wall_time' (as compared to the sampling * rate) indicates this scenario. */ - if (unlikely(wall_time > (2 * sampling_rate)) && - j_cdbs->copy_prev_load) { + if (unlikely(wall_time > (2 * sampling_rate) && + j_cdbs->prev_load)) { load = j_cdbs->prev_load; - j_cdbs->copy_prev_load = false; + + /* + * Ensure that we copy the previous load only once, upon + * the first wake-up from idle. + */ + j_cdbs->prev_load = 0; } else { load = 100 * (wall_time - idle_time) / wall_time; j_cdbs->prev_load = load; - j_cdbs->copy_prev_load = true; } if (load > max_load) @@ -373,7 +377,6 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy, (j_cdbs->prev_cpu_wall - j_cdbs->prev_cpu_idle); j_cdbs->prev_load = 100 * prev_load / (unsigned int) j_cdbs->prev_cpu_wall; - j_cdbs->copy_prev_load = true; if (ignore_nice) j_cdbs->prev_cpu_nice = diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h index c2a5b7e..d3082ee 100644 --- a/drivers/cpufreq/cpufreq_governor.h +++ b/drivers/cpufreq/cpufreq_governor.h @@ -134,12 +134,12 @@ struct cpu_dbs_common_info { u64 prev_cpu_idle; u64 prev_cpu_wall; u64 prev_cpu_nice; - unsigned int prev_load; /* - * Flag to ensure that we copy the previous load only once, upon the - * first wake-up from idle. + * Used to store system load before going into idle, when set to zero: + * used as a flag to ensure that we copy the previous load only once, + * upon the first wake-up from idle. */ - bool copy_prev_load; + unsigned int prev_load; struct cpufreq_policy *cur_policy; struct delayed_work work; /*