Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932153AbbFXPAZ (ORCPT ); Wed, 24 Jun 2015 11:00:25 -0400 Received: from shelob.surriel.com ([74.92.59.67]:32798 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752980AbbFXO6K (ORCPT ); Wed, 24 Jun 2015 10:58:10 -0400 From: riel@redhat.com To: linux-kernel@vger.kernel.org Cc: fweisbec@redhat.com, peterz@infradead.org, mingo@kernel.org, tglx@linutronix.de, luto@amacapital.net Subject: [RFC PATCH 05/11] time,nohz: add cpu parameter to account_steal_time Date: Wed, 24 Jun 2015 10:57:54 -0400 Message-Id: <1435157880-22925-6-git-send-email-riel@redhat.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1435157880-22925-1-git-send-email-riel@redhat.com> References: <1435157880-22925-1-git-send-email-riel@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2455 Lines: 68 From: Rik van Riel Simple transformation to allow tick based sampling from a remote cpu. Additional changes may be needed to actually acquire the steal time info for remote cpus from the host/hypervisor. Signed-off-by: Rik van Riel --- include/linux/kernel_stat.h | 2 +- kernel/sched/cputime.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h index 25a822f6f000..4490aef2f149 100644 --- a/include/linux/kernel_stat.h +++ b/include/linux/kernel_stat.h @@ -80,7 +80,7 @@ static inline unsigned int kstat_cpu_irqs_sum(unsigned int cpu) extern void account_user_time(struct task_struct *, cputime_t, cputime_t); extern void account_system_time(struct task_struct *, int, cputime_t, cputime_t); -extern void account_steal_time(cputime_t); +extern void account_steal_time(int cpu, cputime_t); extern void account_idle_time(cputime_t); #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c index 9717d86cf2ab..b684c48ad954 100644 --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c @@ -232,9 +232,10 @@ void account_system_time(struct task_struct *p, int hardirq_offset, * Account for involuntary wait time. * @cputime: the cpu time spent in involuntary wait */ -void account_steal_time(cputime_t cputime) +void account_steal_time(int cpu, cputime_t cputime) { - u64 *cpustat = kcpustat_this_cpu->cpustat; + struct kernel_cpustat *kstat = &kcpustat_cpu(cpu); + u64 *cpustat = kstat->cpustat; cpustat[CPUTIME_STEAL] += (__force u64) cputime; } @@ -272,7 +273,7 @@ static __always_inline bool steal_account_process_tick(int cpu) steal_ct = nsecs_to_cputime(steal); cpu_rq(cpu)->prev_steal_time += cputime_to_nsecs(steal_ct); - account_steal_time(steal_ct); + account_steal_time(cpu, steal_ct); return steal_ct; } #endif @@ -502,7 +503,7 @@ void account_process_tick(struct task_struct *p, int user_tick) */ void account_steal_ticks(unsigned long ticks) { - account_steal_time(jiffies_to_cputime(ticks)); + account_steal_time(smp_processor_id(), jiffies_to_cputime(ticks)); } /* -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/