X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=kernel%2Fsched.c;h=16f3f77f71beccb828d47e3870a3650a9db255c5;hb=dca45ad8af54963c005393a484ad117b8ba6150f;hp=7b443ee27be4aba135c66c4b3a7071f0b8b269c5;hpb=68c38fc3cb4e5a60f502ee9c45f3dfe70e5165ad;p=android-x86%2Fkernel.git diff --git a/kernel/sched.c b/kernel/sched.c index 7b443ee27be4..16f3f77f71be 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -1277,6 +1277,12 @@ static void sched_avg_update(struct rq *rq) s64 period = sched_avg_period(); while ((s64)(rq->clock - rq->age_stamp) > period) { + /* + * Inline assembly required to prevent the compiler + * optimising this loop into a divmod call. + * See __iter_div_u64_rem() for another example of this. + */ + asm("" : "+rm" (rq->age_stamp)); rq->age_stamp += period; rq->rt_avg /= 2; } @@ -1680,9 +1686,6 @@ static void update_shares(struct sched_domain *sd) static void update_h_load(long cpu) { - if (root_task_group_empty()) - return; - walk_tg_tree(tg_load_down, tg_nop, (void *)cpu); } @@ -2564,7 +2567,16 @@ void sched_fork(struct task_struct *p, int clone_flags) if (p->sched_class->task_fork) p->sched_class->task_fork(p); + /* + * The child is not yet in the pid-hash so no cgroup attach races, + * and the cgroup is pinned to this child due to cgroup_fork() + * is ran before sched_fork(). + * + * Silence PROVE_RCU. + */ + rcu_read_lock(); set_task_cpu(p, cpu); + rcu_read_unlock(); #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) if (likely(sched_info_on())) @@ -2934,9 +2946,9 @@ unsigned long nr_iowait(void) return sum; } -unsigned long nr_iowait_cpu(void) +unsigned long nr_iowait_cpu(int cpu) { - struct rq *this = this_rq(); + struct rq *this = cpu_rq(cpu); return atomic_read(&this->nr_iowait); }