Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753679AbbFXO6V (ORCPT ); Wed, 24 Jun 2015 10:58:21 -0400 Received: from shelob.surriel.com ([74.92.59.67]:32789 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752891AbbFXO6J (ORCPT ); Wed, 24 Jun 2015 10:58:09 -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 03/11] time,nohz: add cpu parameter to irqtime_account_process_tick Date: Wed, 24 Jun 2015 10:57:52 -0400 Message-Id: <1435157880-22925-4-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: 2569 Lines: 69 From: Rik van Riel Add a cpu parameter to irqtime_account_process_tick, to specify what cpu to run the statistics for. In order for this to actually work on a different cpu, all the functions called by irqtime_account_process_tick need to be able to handle workng for another CPU. Signed-off-by: Rik van Riel --- kernel/sched/cputime.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c index 84b2d24a2238..7df761cd6dfc 100644 --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c @@ -336,12 +336,14 @@ void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times) * p->stime and friends are only updated on system time and not on irq * softirq as those do not count in task exec_runtime any more. */ -static void irqtime_account_process_tick(struct task_struct *p, int user_tick, +static void irqtime_account_process_tick(struct task_struct *p, int cpu, + int user_tick, struct rq *rq, int ticks) { cputime_t scaled = cputime_to_scaled(cputime_one_jiffy); + struct kernel_cpustat *kstat = &kcpustat_cpu(cpu); u64 cputime = (__force u64) cputime_one_jiffy; - u64 *cpustat = kcpustat_this_cpu->cpustat; + u64 *cpustat = kstat->cpustat; if (steal_account_process_tick()) return; @@ -374,12 +376,14 @@ static void irqtime_account_process_tick(struct task_struct *p, int user_tick, static void irqtime_account_idle_ticks(int ticks) { struct rq *rq = this_rq(); + int cpu = smp_processor_id(); - irqtime_account_process_tick(current, 0, rq, ticks); + irqtime_account_process_tick(current, cpu, 0, rq, ticks); } #else /* CONFIG_IRQ_TIME_ACCOUNTING */ static inline void irqtime_account_idle_ticks(int ticks) {} -static inline void irqtime_account_process_tick(struct task_struct *p, int user_tick, +static inline void irqtime_account_process_tick(struct task_struct *p, int cpu, + int user_tick, struct rq *rq, int nr_ticks) {} #endif /* CONFIG_IRQ_TIME_ACCOUNTING */ @@ -475,7 +479,7 @@ void account_process_tick(struct task_struct *p, int user_tick) return; if (sched_clock_irqtime) { - irqtime_account_process_tick(p, user_tick, rq, 1); + irqtime_account_process_tick(p, cpu, user_tick, rq, 1); return; } -- 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/