From patchwork Fri Feb 22 06:21:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 2174691 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 34E2D3FD4E for ; Fri, 22 Feb 2013 06:25:03 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U8m0z-0005Rr-4w; Fri, 22 Feb 2013 06:21:49 +0000 Received: from mail-wi0-f180.google.com ([209.85.212.180]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1U8m0v-0005RH-P6 for linux-arm-kernel@lists.infradead.org; Fri, 22 Feb 2013 06:21:47 +0000 Received: by mail-wi0-f180.google.com with SMTP id hi8so310610wib.1 for ; Thu, 21 Feb 2013 22:21:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=eNoudP8+rSrCm3m8XQv/eG03rb0BZciUDGgb6lSWzfY=; b=eY4IuEfw/v825Y6BNHkP/zl3bd3SM26/+zIAyjeb3kzcnnhMTQKHYQuv9646TljEgY pR4h6jnSzPKtQWMPJmw1w0OX5h90oDerGXD2D0JDeCToScp4Q4XS4pbTK8SErIm5IU/c DCh8K8mZ/T25m3OcPWv8vtXSHdV34cXhWU2McNZ54p7LjqhPAJAglKU+BRriKFt2kUE1 fXBDNDWNsaV5NUJH8n9ygOCtNWSX2Bves5x8MiivQGHc2JLe9FqJq6s8A5MJNPjYcnZY IC1iEb9Lo+mUx6KpOmQj/4aDdN+gF7T4N9LgjYpoDbHxMAwcyYRR/UavJougjTJvsm4e nmDw== MIME-Version: 1.0 X-Received: by 10.194.77.129 with SMTP id s1mr1138928wjw.17.1361514103111; Thu, 21 Feb 2013 22:21:43 -0800 (PST) Received: by 10.194.42.234 with HTTP; Thu, 21 Feb 2013 22:21:43 -0800 (PST) In-Reply-To: <1361512604-2720-2-git-send-email-khilman@linaro.org> References: <1361512604-2720-1-git-send-email-khilman@linaro.org> <1361512604-2720-2-git-send-email-khilman@linaro.org> Date: Fri, 22 Feb 2013 11:51:43 +0530 X-Google-Sender-Auth: u_UoMACGN3wrgDJaGrhEB32UA7I Message-ID: Subject: Re: [PATCH 1/2] cpustat: use accessor functions for get/set/add From: Viresh Kumar To: Kevin Hilman X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130222_012145_990179_5BE451B8 X-CRM114-Status: GOOD ( 13.52 ) X-Spam-Score: 0.4 (/) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (0.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- 3.0 KHOP_BIG_TO_CC Sent to 10+ recipients instaed of Bcc or a list -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.180 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (viresh.linux[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: linaro-kernel@lists.linaro.org, Peter Zijlstra , Frederic Weisbecker , linux-kernel@vger.kernel.org, Steven Rostedt , "Rafael J. Wysocki" , Russell King , Thomas Gleixner , Ingo Molnar , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Fri, Feb 22, 2013 at 11:26 AM, Kevin Hilman wrote: > Add some accessor functions in order to facilitate the conversion to > atomic reads/writes of cpustat values. > > Signed-off-by: Kevin Hilman > --- > drivers/cpufreq/cpufreq_governor.c | 18 ++++++++--------- > drivers/cpufreq/cpufreq_ondemand.c | 2 +- > diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c > index 6c5f1d3..ec6c315 100644 > --- a/drivers/cpufreq/cpufreq_governor.c > +++ b/drivers/cpufreq/cpufreq_governor.c > @@ -36,12 +36,12 @@ static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall) > > cur_wall_time = jiffies64_to_cputime64(get_jiffies_64()); > > - busy_time = kcpustat_cpu(cpu).cpustat[CPUTIME_USER]; > - busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_SYSTEM]; > - busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_IRQ]; > - busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_SOFTIRQ]; > - busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_STEAL]; > - busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_NICE]; > + busy_time = kcpustat_cpu_get(cpu, CPUTIME_USER); > + busy_time += kcpustat_cpu_get(cpu, CPUTIME_SYSTEM); > + busy_time += kcpustat_cpu_get(cpu, CPUTIME_IRQ); > + busy_time += kcpustat_cpu_get(cpu, CPUTIME_SOFTIRQ); > + busy_time += kcpustat_cpu_get(cpu, CPUTIME_STEAL); > + busy_time += kcpustat_cpu_get(cpu, CPUTIME_NICE); > > idle_time = cur_wall_time - busy_time; > if (wall) > @@ -103,7 +103,7 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu) > u64 cur_nice; > unsigned long cur_nice_jiffies; > > - cur_nice = kcpustat_cpu(j).cpustat[CPUTIME_NICE] - > + cur_nice = kcpustat_cpu_get(j, CPUTIME_NICE) - > cdbs->prev_cpu_nice; > /* > * Assumption: nice time between sampling periods will > @@ -113,7 +113,7 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu) > cputime64_to_jiffies64(cur_nice); > > cdbs->prev_cpu_nice = > - kcpustat_cpu(j).cpustat[CPUTIME_NICE]; > + kcpustat_cpu_get(j, CPUTIME_NICE); > idle_time += jiffies_to_usecs(cur_nice_jiffies); > } > > @@ -216,7 +216,7 @@ int cpufreq_governor_dbs(struct dbs_data *dbs_data, > &j_cdbs->prev_cpu_wall); > if (ignore_nice) > j_cdbs->prev_cpu_nice = > - kcpustat_cpu(j).cpustat[CPUTIME_NICE]; > + kcpustat_cpu_get(j, CPUTIME_NICE); > } > > /* > diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c > index 7731f7c..ac5d49f 100644 > --- a/drivers/cpufreq/cpufreq_ondemand.c > +++ b/drivers/cpufreq/cpufreq_ondemand.c > @@ -403,7 +403,7 @@ static ssize_t store_ignore_nice_load(struct kobject *a, struct attribute *b, > &dbs_info->cdbs.prev_cpu_wall); > if (od_tuners.ignore_nice) > dbs_info->cdbs.prev_cpu_nice = > - kcpustat_cpu(j).cpustat[CPUTIME_NICE]; > + kcpustat_cpu_get(j, CPUTIME_NICE); > > } > return count; For cpufreq: Acked-by: Viresh Kumar Though i believe you also need this: } BTW, i don't see kcpustat_cpu() used in kernel/sched/core.c | 12 +++++------- kernel/sched/cputime.c | 29 +++++++++++++-------------- I searched tip/master as well as lnext/master. diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 64ef737..38e3ad7 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c @@ -242,7 +242,7 @@ static ssize_t store_ignore_nice_load(struct kobject *a, struct attribute *b, &dbs_info->cdbs.prev_cpu_wall); if (cs_tuners.ignore_nice) dbs_info->cdbs.prev_cpu_nice = - kcpustat_cpu(j).cpustat[CPUTIME_NICE]; + kcpustat_cpu_get(j, CPUTIME_NICE); } return count;