diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-01-09 02:38:23 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-01-09 02:38:23 -0500 |
commit | da733563be5a9da26fe81d9f007262d00b846e22 (patch) | |
tree | db28291df94a2043af2123911984c5c173da4e6f /kernel/posix-cpu-timers.c | |
parent | 6ccbcf2cb41131f8d56ef0723bf3f7c1f8486076 (diff) | |
parent | dab78d7924598ea4031663dd10db814e2e324928 (diff) |
Merge branch 'next' into for-linus
Diffstat (limited to 'kernel/posix-cpu-timers.c')
-rw-r--r-- | kernel/posix-cpu-timers.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index 58f405b581e7..e7cb76dc18f5 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c | |||
@@ -250,7 +250,7 @@ void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times) | |||
250 | do { | 250 | do { |
251 | times->utime = cputime_add(times->utime, t->utime); | 251 | times->utime = cputime_add(times->utime, t->utime); |
252 | times->stime = cputime_add(times->stime, t->stime); | 252 | times->stime = cputime_add(times->stime, t->stime); |
253 | times->sum_exec_runtime += t->se.sum_exec_runtime; | 253 | times->sum_exec_runtime += task_sched_runtime(t); |
254 | } while_each_thread(tsk, t); | 254 | } while_each_thread(tsk, t); |
255 | out: | 255 | out: |
256 | rcu_read_unlock(); | 256 | rcu_read_unlock(); |
@@ -274,9 +274,7 @@ void thread_group_cputimer(struct task_struct *tsk, struct task_cputime *times) | |||
274 | struct task_cputime sum; | 274 | struct task_cputime sum; |
275 | unsigned long flags; | 275 | unsigned long flags; |
276 | 276 | ||
277 | spin_lock_irqsave(&cputimer->lock, flags); | ||
278 | if (!cputimer->running) { | 277 | if (!cputimer->running) { |
279 | cputimer->running = 1; | ||
280 | /* | 278 | /* |
281 | * The POSIX timer interface allows for absolute time expiry | 279 | * The POSIX timer interface allows for absolute time expiry |
282 | * values through the TIMER_ABSTIME flag, therefore we have | 280 | * values through the TIMER_ABSTIME flag, therefore we have |
@@ -284,10 +282,13 @@ void thread_group_cputimer(struct task_struct *tsk, struct task_cputime *times) | |||
284 | * it. | 282 | * it. |
285 | */ | 283 | */ |
286 | thread_group_cputime(tsk, &sum); | 284 | thread_group_cputime(tsk, &sum); |
285 | raw_spin_lock_irqsave(&cputimer->lock, flags); | ||
286 | cputimer->running = 1; | ||
287 | update_gt_cputime(&cputimer->cputime, &sum); | 287 | update_gt_cputime(&cputimer->cputime, &sum); |
288 | } | 288 | } else |
289 | raw_spin_lock_irqsave(&cputimer->lock, flags); | ||
289 | *times = cputimer->cputime; | 290 | *times = cputimer->cputime; |
290 | spin_unlock_irqrestore(&cputimer->lock, flags); | 291 | raw_spin_unlock_irqrestore(&cputimer->lock, flags); |
291 | } | 292 | } |
292 | 293 | ||
293 | /* | 294 | /* |
@@ -312,7 +313,8 @@ static int cpu_clock_sample_group(const clockid_t which_clock, | |||
312 | cpu->cpu = cputime.utime; | 313 | cpu->cpu = cputime.utime; |
313 | break; | 314 | break; |
314 | case CPUCLOCK_SCHED: | 315 | case CPUCLOCK_SCHED: |
315 | cpu->sched = thread_group_sched_runtime(p); | 316 | thread_group_cputime(p, &cputime); |
317 | cpu->sched = cputime.sum_exec_runtime; | ||
316 | break; | 318 | break; |
317 | } | 319 | } |
318 | return 0; | 320 | return 0; |
@@ -997,9 +999,9 @@ static void stop_process_timers(struct signal_struct *sig) | |||
997 | struct thread_group_cputimer *cputimer = &sig->cputimer; | 999 | struct thread_group_cputimer *cputimer = &sig->cputimer; |
998 | unsigned long flags; | 1000 | unsigned long flags; |
999 | 1001 | ||
1000 | spin_lock_irqsave(&cputimer->lock, flags); | 1002 | raw_spin_lock_irqsave(&cputimer->lock, flags); |
1001 | cputimer->running = 0; | 1003 | cputimer->running = 0; |
1002 | spin_unlock_irqrestore(&cputimer->lock, flags); | 1004 | raw_spin_unlock_irqrestore(&cputimer->lock, flags); |
1003 | } | 1005 | } |
1004 | 1006 | ||
1005 | static u32 onecputick; | 1007 | static u32 onecputick; |
@@ -1289,9 +1291,9 @@ static inline int fastpath_timer_check(struct task_struct *tsk) | |||
1289 | if (sig->cputimer.running) { | 1291 | if (sig->cputimer.running) { |
1290 | struct task_cputime group_sample; | 1292 | struct task_cputime group_sample; |
1291 | 1293 | ||
1292 | spin_lock(&sig->cputimer.lock); | 1294 | raw_spin_lock(&sig->cputimer.lock); |
1293 | group_sample = sig->cputimer.cputime; | 1295 | group_sample = sig->cputimer.cputime; |
1294 | spin_unlock(&sig->cputimer.lock); | 1296 | raw_spin_unlock(&sig->cputimer.lock); |
1295 | 1297 | ||
1296 | if (task_cputime_expired(&group_sample, &sig->cputime_expires)) | 1298 | if (task_cputime_expired(&group_sample, &sig->cputime_expires)) |
1297 | return 1; | 1299 | return 1; |