tree-wide: fix typos "couter" -> "counter"
[safe/jmp/linux-2.6] / kernel / posix-cpu-timers.c
index 69c9237..5c9dc22 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/math64.h>
 #include <asm/uaccess.h>
 #include <linux/kernel_stat.h>
+#include <trace/events/timer.h>
 
 /*
  * Called after updating RLIMIT_CPU to set timer expiration if necessary.
@@ -521,11 +522,12 @@ void posix_cpu_timers_exit(struct task_struct *tsk)
 }
 void posix_cpu_timers_exit_group(struct task_struct *tsk)
 {
-       struct task_cputime cputime;
+       struct signal_struct *const sig = tsk->signal;
 
-       thread_group_cputimer(tsk, &cputime);
        cleanup_timers(tsk->signal->cpu_timers,
-                      cputime.utime, cputime.stime, cputime.sum_exec_runtime);
+                      cputime_add(tsk->utime, sig->utime),
+                      cputime_add(tsk->stime, sig->stime),
+                      tsk->se.sum_exec_runtime + sig->sum_sched_runtime);
 }
 
 static void clear_dead_task(struct k_itimer *timer, union cpu_time_count now)
@@ -1086,12 +1088,16 @@ static void check_cpu_itimer(struct task_struct *tsk, struct cpu_itimer *it,
                        it->error += it->incr_error;
                        if (it->error >= onecputick) {
                                it->expires = cputime_sub(it->expires,
-                                                       jiffies_to_cputime(1));
+                                                         cputime_one_jiffy);
                                it->error -= onecputick;
                        }
-               } else
+               } else {
                        it->expires = cputime_zero;
+               }
 
+               trace_itimer_expire(signo == SIGPROF ?
+                                   ITIMER_PROF : ITIMER_VIRTUAL,
+                                   tsk->signal->leader_pid, cur_time);
                __group_send_sig_info(signo, SEND_SIG_PRIV, tsk);
        }
 
@@ -1461,7 +1467,7 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clock_idx,
                if (!cputime_eq(*oldval, cputime_zero)) {
                        if (cputime_le(*oldval, now.cpu)) {
                                /* Just about to fire. */
-                               *oldval = jiffies_to_cputime(1);
+                               *oldval = cputime_one_jiffy;
                        } else {
                                *oldval = cputime_sub(*oldval, now.cpu);
                        }
@@ -1712,7 +1718,7 @@ static __init int init_posix_cpu_timers(void)
        register_posix_clock(CLOCK_PROCESS_CPUTIME_ID, &process);
        register_posix_clock(CLOCK_THREAD_CPUTIME_ID, &thread);
 
-       cputime_to_timespec(jiffies_to_cputime(1), &ts);
+       cputime_to_timespec(cputime_one_jiffy, &ts);
        onecputick = ts.tv_nsec;
        WARN_ON(ts.tv_sec != 0);