]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - kernel/sched_fair.c
vmxnet: trivial annotation of protocol constant
[net-next-2.6.git] / kernel / sched_fair.c
index c358d4081b81854dedd3d6bb8488af9dfbc18497..933f3d1b62ea0affb63767f87152545f7659dc6f 100644 (file)
@@ -2275,7 +2275,13 @@ unsigned long scale_rt_power(int cpu)
        u64 total, available;
 
        total = sched_avg_period() + (rq->clock - rq->age_stamp);
-       available = total - rq->rt_avg;
+
+       if (unlikely(total < rq->rt_avg)) {
+               /* Ensures that power won't end up being negative */
+               available = 0;
+       } else {
+               available = total - rq->rt_avg;
+       }
 
        if (unlikely((s64)total < SCHED_LOAD_SCALE))
                total = SCHED_LOAD_SCALE;
@@ -3787,8 +3793,11 @@ static void task_fork_fair(struct task_struct *p)
 
        update_rq_clock(rq);
 
-       if (unlikely(task_cpu(p) != this_cpu))
+       if (unlikely(task_cpu(p) != this_cpu)) {
+               rcu_read_lock();
                __set_task_cpu(p, this_cpu);
+               rcu_read_unlock();
+       }
 
        update_curr(cfs_rq);