diff options
Diffstat (limited to 'kernel/sched/stats.h')
-rw-r--r-- | kernel/sched/stats.h | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/kernel/sched/stats.h b/kernel/sched/stats.h index 4ab704339656..c6d1c7da3ea5 100644 --- a/kernel/sched/stats.h +++ b/kernel/sched/stats.h | |||
@@ -174,7 +174,8 @@ static inline bool cputimer_running(struct task_struct *tsk) | |||
174 | { | 174 | { |
175 | struct thread_group_cputimer *cputimer = &tsk->signal->cputimer; | 175 | struct thread_group_cputimer *cputimer = &tsk->signal->cputimer; |
176 | 176 | ||
177 | if (!cputimer->running) | 177 | /* Check if cputimer isn't running. This is accessed without locking. */ |
178 | if (!READ_ONCE(cputimer->running)) | ||
178 | return false; | 179 | return false; |
179 | 180 | ||
180 | /* | 181 | /* |
@@ -215,9 +216,7 @@ static inline void account_group_user_time(struct task_struct *tsk, | |||
215 | if (!cputimer_running(tsk)) | 216 | if (!cputimer_running(tsk)) |
216 | return; | 217 | return; |
217 | 218 | ||
218 | raw_spin_lock(&cputimer->lock); | 219 | atomic64_add(cputime, &cputimer->utime); |
219 | cputimer->cputime.utime += cputime; | ||
220 | raw_spin_unlock(&cputimer->lock); | ||
221 | } | 220 | } |
222 | 221 | ||
223 | /** | 222 | /** |
@@ -238,9 +237,7 @@ static inline void account_group_system_time(struct task_struct *tsk, | |||
238 | if (!cputimer_running(tsk)) | 237 | if (!cputimer_running(tsk)) |
239 | return; | 238 | return; |
240 | 239 | ||
241 | raw_spin_lock(&cputimer->lock); | 240 | atomic64_add(cputime, &cputimer->stime); |
242 | cputimer->cputime.stime += cputime; | ||
243 | raw_spin_unlock(&cputimer->lock); | ||
244 | } | 241 | } |
245 | 242 | ||
246 | /** | 243 | /** |
@@ -261,7 +258,5 @@ static inline void account_group_exec_runtime(struct task_struct *tsk, | |||
261 | if (!cputimer_running(tsk)) | 258 | if (!cputimer_running(tsk)) |
262 | return; | 259 | return; |
263 | 260 | ||
264 | raw_spin_lock(&cputimer->lock); | 261 | atomic64_add(ns, &cputimer->sum_exec_runtime); |
265 | cputimer->cputime.sum_exec_runtime += ns; | ||
266 | raw_spin_unlock(&cputimer->lock); | ||
267 | } | 262 | } |