Merge branch 'writeback-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[pandora-kernel.git] / kernel / posix-cpu-timers.c
index c8008dd..e7cb76d 100644 (file)
@@ -274,9 +274,7 @@ void thread_group_cputimer(struct task_struct *tsk, struct task_cputime *times)
        struct task_cputime sum;
        unsigned long flags;
 
-       spin_lock_irqsave(&cputimer->lock, flags);
        if (!cputimer->running) {
-               cputimer->running = 1;
                /*
                 * The POSIX timer interface allows for absolute time expiry
                 * 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)
                 * it.
                 */
                thread_group_cputime(tsk, &sum);
+               raw_spin_lock_irqsave(&cputimer->lock, flags);
+               cputimer->running = 1;
                update_gt_cputime(&cputimer->cputime, &sum);
-       }
+       } else
+               raw_spin_lock_irqsave(&cputimer->lock, flags);
        *times = cputimer->cputime;
-       spin_unlock_irqrestore(&cputimer->lock, flags);
+       raw_spin_unlock_irqrestore(&cputimer->lock, flags);
 }
 
 /*
@@ -998,9 +999,9 @@ static void stop_process_timers(struct signal_struct *sig)
        struct thread_group_cputimer *cputimer = &sig->cputimer;
        unsigned long flags;
 
-       spin_lock_irqsave(&cputimer->lock, flags);
+       raw_spin_lock_irqsave(&cputimer->lock, flags);
        cputimer->running = 0;
-       spin_unlock_irqrestore(&cputimer->lock, flags);
+       raw_spin_unlock_irqrestore(&cputimer->lock, flags);
 }
 
 static u32 onecputick;
@@ -1290,9 +1291,9 @@ static inline int fastpath_timer_check(struct task_struct *tsk)
        if (sig->cputimer.running) {
                struct task_cputime group_sample;
 
-               spin_lock(&sig->cputimer.lock);
+               raw_spin_lock(&sig->cputimer.lock);
                group_sample = sig->cputimer.cputime;
-               spin_unlock(&sig->cputimer.lock);
+               raw_spin_unlock(&sig->cputimer.lock);
 
                if (task_cputime_expired(&group_sample, &sig->cputime_expires))
                        return 1;