From patchwork Thu May 16 09:28:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 16990 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f199.google.com (mail-qc0-f199.google.com [209.85.216.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7E5D22391B for ; Thu, 16 May 2013 09:32:53 +0000 (UTC) Received: by mail-qc0-f199.google.com with SMTP id c10sf2169938qcz.2 for ; Thu, 16 May 2013 02:32:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:in-reply-to:references:x-gm-message-state :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-google-group-id:list-post:list-help :list-archive:list-unsubscribe; bh=R18ZwIZaV01734vFewdmRR9ybTT4amKdtC38CcC8U7k=; b=LRr13GaONvLmIwKAP83wfCgnV/JraftH7wRUc57z3EO8FQT952d8LuqoIgiXIZrqSz qykhOkCwtYlSwKavnhH4g+fC64P64Ks0p3LMGsBJ95dBbNDCsQBvjOti7ZDegA1vs8sK uTrKuBOF7SF9wSyBmaMY3sRi2hPzm7NwJSyWL3sdPhcRKhiy6c4wTK5eecCdxc7nuk1i 4TSbJ5YEefILSGer/sbFtBgPA3zw2vFT4nocwK08zEw1aCayDC/iOhH33LFl7wcrYWBw ldGxXCRI66RQd+Lm7GDbzifTKI9puZ/L4kgnuTjQyngZLkldYpGADiZLsMKGdAxUOSwI F15Q== X-Received: by 10.224.59.205 with SMTP id m13mr25435385qah.7.1368696734708; Thu, 16 May 2013 02:32:14 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.131.71 with SMTP id ok7ls1163775qeb.52.gmail; Thu, 16 May 2013 02:32:14 -0700 (PDT) X-Received: by 10.52.29.19 with SMTP id f19mr23279265vdh.100.1368696734524; Thu, 16 May 2013 02:32:14 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id p8si3517221vdv.18.2013.05.16.02.32.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 May 2013 02:32:14 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id hv10so2568067vcb.6 for ; Thu, 16 May 2013 02:32:14 -0700 (PDT) X-Received: by 10.52.34.114 with SMTP id y18mr445582vdi.56.1368696734360; Thu, 16 May 2013 02:32:14 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.126.138 with SMTP id c10csp56055vcs; Thu, 16 May 2013 02:32:13 -0700 (PDT) X-Received: by 10.68.171.36 with SMTP id ar4mr14840665pbc.195.1368696733508; Thu, 16 May 2013 02:32:13 -0700 (PDT) Received: from mail-pd0-f169.google.com (mail-pd0-f169.google.com [209.85.192.169]) by mx.google.com with ESMTPS id fc5si4106495pbc.242.2013.05.16.02.32.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 May 2013 02:32:13 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.169 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.169; Received: by mail-pd0-f169.google.com with SMTP id y10so1430361pdj.14 for ; Thu, 16 May 2013 02:32:13 -0700 (PDT) X-Received: by 10.68.175.97 with SMTP id bz1mr42351202pbc.37.1368696733078; Thu, 16 May 2013 02:32:13 -0700 (PDT) Received: from localhost ([106.197.193.133]) by mx.google.com with ESMTPSA id ag4sm6137658pbc.20.2013.05.16.02.32.06 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 May 2013 02:32:12 -0700 (PDT) From: Viresh Kumar To: toddpoynor@google.com Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, robin.randhawa@arm.com, Steve.Bannister@arm.com, Liviu.Dudau@arm.com, charles.garcia-tobin@arm.com, arvind.chauhan@arm.com, android-kernel@googlegroups.com, viresh.kumar@linaro.org Subject: [PATCH 13/16] cpufreq: interactive: Use generic get_cpu_idle_time() from cpufreq.c Date: Thu, 16 May 2013 14:58:51 +0530 Message-Id: <413844c8d18a24ca15eb31d1b4a2bd0d219fcba5.1368696171.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQmISEkuuMYfKgG3LXhUSF6Uyj51tsMgvMUHTp5U4RYvKKvFDs55B1Q9jrbINUZfya88oECI X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Generic version of get_cpu_idle_time() is present in cpufreq.c file. We must not replicate that for Interactive governor, rather use the same one. Lets do it. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq_interactive.c | 42 ++--------------------------------- 1 file changed, 2 insertions(+), 40 deletions(-) diff --git a/drivers/cpufreq/cpufreq_interactive.c b/drivers/cpufreq/cpufreq_interactive.c index baf8740..4ed2fed 100644 --- a/drivers/cpufreq/cpufreq_interactive.c +++ b/drivers/cpufreq/cpufreq_interactive.c @@ -30,8 +30,6 @@ #include #include #include -#include -#include #define CREATE_TRACE_POINTS #include @@ -130,42 +128,6 @@ struct cpufreq_governor cpufreq_gov_interactive = { .owner = THIS_MODULE, }; -static inline cputime64_t get_cpu_idle_time_jiffy(unsigned int cpu, - cputime64_t *wall) -{ - u64 idle_time; - u64 cur_wall_time; - u64 busy_time; - - 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]; - - idle_time = cur_wall_time - busy_time; - if (wall) - *wall = jiffies_to_usecs(cur_wall_time); - - return jiffies_to_usecs(idle_time); -} - -static inline cputime64_t get_cpu_idle_time(unsigned int cpu, - cputime64_t *wall) -{ - u64 idle_time = get_cpu_idle_time_us(cpu, wall); - - if (idle_time == -1ULL) - idle_time = get_cpu_idle_time_jiffy(cpu, wall); - else if (!io_is_busy) - idle_time += get_cpu_iowait_time_us(cpu, wall); - - return idle_time; -} - static void cpufreq_interactive_timer_resched( struct cpufreq_interactive_cpuinfo *pcpu) { @@ -181,7 +143,7 @@ static void cpufreq_interactive_timer_resched( spin_lock_irqsave(&pcpu->load_lock, flags); pcpu->time_in_idle = get_cpu_idle_time(smp_processor_id(), - &pcpu->time_in_idle_timestamp); + &pcpu->time_in_idle_timestamp, io_is_busy); pcpu->cputime_speedadj = 0; pcpu->cputime_speedadj_timestamp = pcpu->time_in_idle_timestamp; spin_unlock_irqrestore(&pcpu->load_lock, flags); @@ -317,7 +279,7 @@ static u64 update_load(int cpu) unsigned int delta_time; u64 active_time; - now_idle = get_cpu_idle_time(cpu, &now); + now_idle = get_cpu_idle_time(cpu, &now, io_is_busy); delta_idle = (unsigned int)(now_idle - pcpu->time_in_idle); delta_time = (unsigned int)(now - pcpu->time_in_idle_timestamp); active_time = delta_time - delta_idle;