Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941719AbcKQSKF (ORCPT ); Thu, 17 Nov 2016 13:10:05 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36266 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937878AbcKQSJv (ORCPT ); Thu, 17 Nov 2016 13:09:51 -0500 From: Frederic Weisbecker To: LKML Cc: Frederic Weisbecker , Tony Luck , Wanpeng Li , Peter Zijlstra , Michael Ellerman , Heiko Carstens , Benjamin Herrenschmidt , Thomas Gleixner , Paul Mackerras , Ingo Molnar , Fenghua Yu , Rik van Riel , Martin Schwidefsky , Stanislaw Gruszka Subject: [PATCH 30/36] ia64: Convert vtime to use nsec units directly Date: Thu, 17 Nov 2016 19:08:37 +0100 Message-Id: <1479406123-24785-31-git-send-email-fweisbec@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1479406123-24785-1-git-send-email-fweisbec@gmail.com> References: <1479406123-24785-1-git-send-email-fweisbec@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3487 Lines: 109 There is no need anymore for this cputime_t midlayer. Let's use nsec units directly. Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Heiko Carstens Cc: Martin Schwidefsky Cc: Tony Luck Cc: Fenghua Yu Cc: Peter Zijlstra Cc: Rik van Riel Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Stanislaw Gruszka Cc: Wanpeng Li Signed-off-by: Frederic Weisbecker --- arch/ia64/kernel/head.S | 4 ++-- arch/ia64/kernel/time.c | 17 ++++++++--------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S index c9b5e94..3204fdd 100644 --- a/arch/ia64/kernel/head.S +++ b/arch/ia64/kernel/head.S @@ -1031,7 +1031,7 @@ GLOBAL_ENTRY(ia64_native_sched_clock) END(ia64_native_sched_clock) #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE -GLOBAL_ENTRY(cycle_to_cputime) +GLOBAL_ENTRY(cycle_to_nsec) alloc r16=ar.pfs,1,0,0,0 addl r8=THIS_CPU(ia64_cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0 ;; @@ -1047,7 +1047,7 @@ GLOBAL_ENTRY(cycle_to_cputime) ;; shrp r8=r9,r8,IA64_NSEC_PER_CYC_SHIFT br.ret.sptk.many rp -END(cycle_to_cputime) +END(cycle_to_nsec) #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ #ifdef CONFIG_IA64_BRL_EMU diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c index 0aba18e..03eb959 100644 --- a/arch/ia64/kernel/time.c +++ b/arch/ia64/kernel/time.c @@ -59,7 +59,7 @@ static struct clocksource *itc_clocksource; #include -extern cputime_t cycle_to_cputime(u64 cyc); +extern u64 cycle_to_nsec(u64 cyc); void vtime_account_user(struct task_struct *tsk) { @@ -67,8 +67,7 @@ void vtime_account_user(struct task_struct *tsk) struct thread_info *ti = task_thread_info(tsk); if (ti->ac_utime) { - /* TODO: cycle_to_ns */ - delta_utime = cputime_to_nsecs(cycle_to_cputime(ti->ac_utime)); + delta_utime = cycle_to_nsec(ti->ac_utime); account_user_time(tsk, delta_utime); ti->ac_utime = 0; } @@ -92,17 +91,17 @@ void arch_vtime_task_switch(struct task_struct *prev) * Account time for a transition between system, hard irq or soft irq state. * Note that this function is called with interrupts enabled. */ -static cputime_t vtime_delta(struct task_struct *tsk) +static u64 vtime_delta(struct task_struct *tsk) { struct thread_info *ti = task_thread_info(tsk); - cputime_t delta_stime; + u64 delta_stime; __u64 now; WARN_ON_ONCE(!irqs_disabled()); now = ia64_get_itc(); - delta_stime = cycle_to_cputime(ti->ac_stime + (now - ti->ac_stamp)); + delta_stime = cycle_to_nsec(ti->ac_stime + (now - ti->ac_stamp)); ti->ac_stime = 0; ti->ac_stamp = now; @@ -111,15 +110,15 @@ static cputime_t vtime_delta(struct task_struct *tsk) void vtime_account_system(struct task_struct *tsk) { - cputime_t delta = vtime_delta(tsk); + u64 delta = vtime_delta(tsk); - account_system_time(tsk, 0, cputime_to_nsecs(delta)); + account_system_time(tsk, 0, delta); } EXPORT_SYMBOL_GPL(vtime_account_system); void vtime_account_idle(struct task_struct *tsk) { - account_idle_time(cputime_to_nsecs(vtime_delta(tsk))); + account_idle_time(vtime_delta(tsk)); } #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ -- 2.7.4