[PATCH] posix-timers: exit path cleanup
authorOleg Nesterov <oleg@tv-sign.ru>
Mon, 24 Oct 2005 10:36:28 +0000 (14:36 +0400)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 24 Oct 2005 15:12:35 +0000 (08:12 -0700)
No need to rebalance when task exited

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/posix-cpu-timers.c

index ccb04683bf1860145651248003b4c1a256bf6288..92a038064628feebcbf167e65bae85767fffb5a7 100644 (file)
@@ -486,6 +486,9 @@ static void process_timer_rebalance(struct task_struct *p,
        struct task_struct *t = p;
        unsigned int nthreads = atomic_read(&p->signal->live);
 
+       if (!nthreads)
+               return;
+
        switch (clock_idx) {
        default:
                BUG();
@@ -1160,6 +1163,9 @@ static void check_process_timers(struct task_struct *tsk,
                unsigned long long sched_left, sched;
                const unsigned int nthreads = atomic_read(&sig->live);
 
+               if (!nthreads)
+                       return;
+
                prof_left = cputime_sub(prof_expires, utime);
                prof_left = cputime_sub(prof_left, stime);
                prof_left = cputime_div(prof_left, nthreads);