aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/posix-cpu-timers.c30
1 files changed, 7 insertions, 23 deletions
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
index ab9911b54faf..e6389f915bcb 100644
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -399,8 +399,7 @@ static int posix_cpu_timer_del(struct k_itimer *timer)
399 return ret; 399 return ret;
400} 400}
401 401
402static void cleanup_timers_list(struct list_head *head, 402static void cleanup_timers_list(struct list_head *head)
403 unsigned long long curr)
404{ 403{
405 struct cpu_timer_list *timer, *next; 404 struct cpu_timer_list *timer, *next;
406 405
@@ -414,16 +413,11 @@ static void cleanup_timers_list(struct list_head *head,
414 * time for later timer_gettime calls to return. 413 * time for later timer_gettime calls to return.
415 * This must be called with the siglock held. 414 * This must be called with the siglock held.
416 */ 415 */
417static void cleanup_timers(struct list_head *head, 416static void cleanup_timers(struct list_head *head)
418 cputime_t utime, cputime_t stime,
419 unsigned long long sum_exec_runtime)
420{ 417{
421 418 cleanup_timers_list(head);
422 cputime_t ptime = utime + stime; 419 cleanup_timers_list(++head);
423 420 cleanup_timers_list(++head);
424 cleanup_timers_list(head, cputime_to_expires(ptime));
425 cleanup_timers_list(++head, cputime_to_expires(utime));
426 cleanup_timers_list(++head, sum_exec_runtime);
427} 421}
428 422
429/* 423/*
@@ -433,24 +427,14 @@ static void cleanup_timers(struct list_head *head,
433 */ 427 */
434void posix_cpu_timers_exit(struct task_struct *tsk) 428void posix_cpu_timers_exit(struct task_struct *tsk)
435{ 429{
436 cputime_t utime, stime;
437
438 add_device_randomness((const void*) &tsk->se.sum_exec_runtime, 430 add_device_randomness((const void*) &tsk->se.sum_exec_runtime,
439 sizeof(unsigned long long)); 431 sizeof(unsigned long long));
440 task_cputime(tsk, &utime, &stime); 432 cleanup_timers(tsk->cpu_timers);
441 cleanup_timers(tsk->cpu_timers,
442 utime, stime, tsk->se.sum_exec_runtime);
443 433
444} 434}
445void posix_cpu_timers_exit_group(struct task_struct *tsk) 435void posix_cpu_timers_exit_group(struct task_struct *tsk)
446{ 436{
447 struct signal_struct *const sig = tsk->signal; 437 cleanup_timers(tsk->signal->cpu_timers);
448 cputime_t utime, stime;
449
450 task_cputime(tsk, &utime, &stime);
451 cleanup_timers(tsk->signal->cpu_timers,
452 utime + sig->utime, stime + sig->stime,
453 tsk->se.sum_exec_runtime + sig->sum_sched_runtime);
454} 438}
455 439
456static inline int expires_gt(cputime_t expires, cputime_t new_exp) 440static inline int expires_gt(cputime_t expires, cputime_t new_exp)