[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1435157880-22925-6-git-send-email-riel@redhat.com>
Date: Wed, 24 Jun 2015 10:57:54 -0400
From: riel@...hat.com
To: linux-kernel@...r.kernel.org
Cc: fweisbec@...hat.com, peterz@...radead.org, mingo@...nel.org,
tglx@...utronix.de, luto@...capital.net
Subject: [RFC PATCH 05/11] time,nohz: add cpu parameter to account_steal_time
From: Rik van Riel <riel@...hat.com>
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 <riel@...hat.com>
---
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists