diff options
author | Ingo Molnar <mingo@kernel.org> | 2012-12-08 09:44:43 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2012-12-08 09:44:43 -0500 |
commit | 38130ec08716ae2ece8060eca01607b58da7258c (patch) | |
tree | 71d0cd76ccfb2b960ddb6b820850269265389052 /arch/ia64 | |
parent | e783377e93d4043a11013ce6e9173db34998e653 (diff) | |
parent | 1b2852b152be5150fbef7b585388ec43cf6f4415 (diff) |
Merge tag 'sched-cputime-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks into sched/core
Pull more cputime cleanups from Frederic Weisbecker:
* Get rid of underscores polluting the vtime namespace
* Consolidate context switch and tick handling
* Improve debuggability by detecting irq unsafe callers
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/ia64')
-rw-r--r-- | arch/ia64/include/asm/cputime.h | 2 | ||||
-rw-r--r-- | arch/ia64/kernel/time.c | 26 |
2 files changed, 8 insertions, 20 deletions
diff --git a/arch/ia64/include/asm/cputime.h b/arch/ia64/include/asm/cputime.h index 3deac956d325..7fcf7f08ab06 100644 --- a/arch/ia64/include/asm/cputime.h +++ b/arch/ia64/include/asm/cputime.h | |||
@@ -103,5 +103,7 @@ static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val) | |||
103 | #define cputime64_to_clock_t(__ct) \ | 103 | #define cputime64_to_clock_t(__ct) \ |
104 | cputime_to_clock_t((__force cputime_t)__ct) | 104 | cputime_to_clock_t((__force cputime_t)__ct) |
105 | 105 | ||
106 | extern void arch_vtime_task_switch(struct task_struct *tsk); | ||
107 | |||
106 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING */ | 108 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING */ |
107 | #endif /* __IA64_CPUTIME_H */ | 109 | #endif /* __IA64_CPUTIME_H */ |
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c index 5e4850305d3f..b1995efbfd21 100644 --- a/arch/ia64/kernel/time.c +++ b/arch/ia64/kernel/time.c | |||
@@ -83,7 +83,7 @@ static struct clocksource *itc_clocksource; | |||
83 | 83 | ||
84 | extern cputime_t cycle_to_cputime(u64 cyc); | 84 | extern cputime_t cycle_to_cputime(u64 cyc); |
85 | 85 | ||
86 | static void vtime_account_user(struct task_struct *tsk) | 86 | void vtime_account_user(struct task_struct *tsk) |
87 | { | 87 | { |
88 | cputime_t delta_utime; | 88 | cputime_t delta_utime; |
89 | struct thread_info *ti = task_thread_info(tsk); | 89 | struct thread_info *ti = task_thread_info(tsk); |
@@ -100,18 +100,11 @@ static void vtime_account_user(struct task_struct *tsk) | |||
100 | * accumulated times to the current process, and to prepare accounting on | 100 | * accumulated times to the current process, and to prepare accounting on |
101 | * the next process. | 101 | * the next process. |
102 | */ | 102 | */ |
103 | void vtime_task_switch(struct task_struct *prev) | 103 | void arch_vtime_task_switch(struct task_struct *prev) |
104 | { | 104 | { |
105 | struct thread_info *pi = task_thread_info(prev); | 105 | struct thread_info *pi = task_thread_info(prev); |
106 | struct thread_info *ni = task_thread_info(current); | 106 | struct thread_info *ni = task_thread_info(current); |
107 | 107 | ||
108 | if (idle_task(smp_processor_id()) != prev) | ||
109 | __vtime_account_system(prev); | ||
110 | else | ||
111 | __vtime_account_idle(prev); | ||
112 | |||
113 | vtime_account_user(prev); | ||
114 | |||
115 | pi->ac_stamp = ni->ac_stamp; | 108 | pi->ac_stamp = ni->ac_stamp; |
116 | ni->ac_stime = ni->ac_utime = 0; | 109 | ni->ac_stime = ni->ac_utime = 0; |
117 | } | 110 | } |
@@ -126,6 +119,8 @@ static cputime_t vtime_delta(struct task_struct *tsk) | |||
126 | cputime_t delta_stime; | 119 | cputime_t delta_stime; |
127 | __u64 now; | 120 | __u64 now; |
128 | 121 | ||
122 | WARN_ON_ONCE(!irqs_disabled()); | ||
123 | |||
129 | now = ia64_get_itc(); | 124 | now = ia64_get_itc(); |
130 | 125 | ||
131 | delta_stime = cycle_to_cputime(ti->ac_stime + (now - ti->ac_stamp)); | 126 | delta_stime = cycle_to_cputime(ti->ac_stime + (now - ti->ac_stamp)); |
@@ -135,27 +130,18 @@ static cputime_t vtime_delta(struct task_struct *tsk) | |||
135 | return delta_stime; | 130 | return delta_stime; |
136 | } | 131 | } |
137 | 132 | ||
138 | void __vtime_account_system(struct task_struct *tsk) | 133 | void vtime_account_system(struct task_struct *tsk) |
139 | { | 134 | { |
140 | cputime_t delta = vtime_delta(tsk); | 135 | cputime_t delta = vtime_delta(tsk); |
141 | 136 | ||
142 | account_system_time(tsk, 0, delta, delta); | 137 | account_system_time(tsk, 0, delta, delta); |
143 | } | 138 | } |
144 | 139 | ||
145 | void __vtime_account_idle(struct task_struct *tsk) | 140 | void vtime_account_idle(struct task_struct *tsk) |
146 | { | 141 | { |
147 | account_idle_time(vtime_delta(tsk)); | 142 | account_idle_time(vtime_delta(tsk)); |
148 | } | 143 | } |
149 | 144 | ||
150 | /* | ||
151 | * Called from the timer interrupt handler to charge accumulated user time | ||
152 | * to the current process. Must be called with interrupts disabled. | ||
153 | */ | ||
154 | void account_process_tick(struct task_struct *p, int user_tick) | ||
155 | { | ||
156 | vtime_account_user(p); | ||
157 | } | ||
158 | |||
159 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING */ | 145 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING */ |
160 | 146 | ||
161 | static irqreturn_t | 147 | static irqreturn_t |