aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ia64')
-rw-r--r--arch/ia64/kernel/time.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 01cd43e491cd..351df5850309 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -83,6 +83,18 @@ static struct clocksource *itc_clocksource;
83 83
84extern cputime_t cycle_to_cputime(u64 cyc); 84extern cputime_t cycle_to_cputime(u64 cyc);
85 85
86static void vtime_account_user(struct task_struct *tsk)
87{
88 cputime_t delta_utime;
89 struct thread_info *ti = task_thread_info(tsk);
90
91 if (ti->ac_utime) {
92 delta_utime = cycle_to_cputime(ti->ac_utime);
93 account_user_time(tsk, delta_utime, delta_utime);
94 ti->ac_utime = 0;
95 }
96}
97
86/* 98/*
87 * Called from the context switch with interrupts disabled, to charge all 99 * Called from the context switch with interrupts disabled, to charge all
88 * accumulated times to the current process, and to prepare accounting on 100 * accumulated times to the current process, and to prepare accounting on
@@ -92,7 +104,7 @@ void vtime_task_switch(struct task_struct *prev)
92{ 104{
93 struct thread_info *pi = task_thread_info(prev); 105 struct thread_info *pi = task_thread_info(prev);
94 struct thread_info *ni = task_thread_info(current); 106 struct thread_info *ni = task_thread_info(current);
95 cputime_t delta_stime, delta_utime; 107 cputime_t delta_stime;
96 __u64 now; 108 __u64 now;
97 109
98 now = ia64_get_itc(); 110 now = ia64_get_itc();
@@ -103,10 +115,7 @@ void vtime_task_switch(struct task_struct *prev)
103 else 115 else
104 account_idle_time(delta_stime); 116 account_idle_time(delta_stime);
105 117
106 if (pi->ac_utime) { 118 vtime_account_user(prev);
107 delta_utime = cycle_to_cputime(pi->ac_utime);
108 account_user_time(prev, delta_utime, delta_utime);
109 }
110 119
111 pi->ac_stamp = ni->ac_stamp = now; 120 pi->ac_stamp = ni->ac_stamp = now;
112 ni->ac_stime = ni->ac_utime = 0; 121 ni->ac_stime = ni->ac_utime = 0;
@@ -149,14 +158,7 @@ void vtime_account_idle(struct task_struct *tsk)
149 */ 158 */
150void account_process_tick(struct task_struct *p, int user_tick) 159void account_process_tick(struct task_struct *p, int user_tick)
151{ 160{
152 struct thread_info *ti = task_thread_info(p); 161 vtime_account_user(p);
153 cputime_t delta_utime;
154
155 if (ti->ac_utime) {
156 delta_utime = cycle_to_cputime(ti->ac_utime);
157 account_user_time(p, delta_utime, delta_utime);
158 ti->ac_utime = 0;
159 }
160} 162}
161 163
162#endif /* CONFIG_VIRT_CPU_ACCOUNTING */ 164#endif /* CONFIG_VIRT_CPU_ACCOUNTING */