--- kernel/sched/bfs.c | 88 ++++++++++++++++++++--------------------------------- 1 file changed, 34 insertions(+), 54 deletions(-) Index: linux-3.3-ck1/kernel/sched/bfs.c =================================================================== --- linux-3.3-ck1.orig/kernel/sched/bfs.c 2012-03-26 23:46:49.000000000 +1100 +++ linux-3.3-ck1/kernel/sched/bfs.c 2012-03-28 00:30:33.363769063 +1100 @@ -498,12 +498,10 @@ static inline void grq_wlock(void) grq_write_lock(); } -static inline void grq_ulock(void) +static inline void grq_lock(void) __acquires(grq.lock) - __acquires(grq.rwlock) { raw_spin_lock(&grq.lock); - grq_read_lock(); } static inline void grq_wunlock(void) @@ -514,11 +512,9 @@ static inline void grq_wunlock(void) raw_spin_unlock(&grq.lock); } -static inline void grq_uunlock(void) - __releases(grq.rwlock) +static inline void grq_unlock(void) __releases(grq.lock) { - grq_read_unlock(); raw_spin_unlock(&grq.lock); } @@ -530,12 +526,10 @@ static inline void grq_wlock_irq(void) grq_write_lock(); } -static inline void grq_ulock_irq(void) +static inline void grq_lock_irq(void) __acquires(grq.lock) - __acquires(grq.rwlock) { raw_spin_lock_irq(&grq.lock); - grq_read_lock(); } static inline void time_wlock_grq(struct rq *rq) @@ -554,11 +548,9 @@ static inline void grq_wunlock_irq(void) raw_spin_unlock_irq(&grq.lock); } -static inline void grq_uunlock_irq(void) - __releases(grq.rwlock) +static inline void grq_unlock_irq(void) __releases(grq.lock) { - grq_read_unlock(); raw_spin_unlock_irq(&grq.lock); } @@ -581,19 +573,15 @@ static inline void grq_wlock_irqsave(uns grq_write_lock(); } -static inline void grq_ulock_irqsave(unsigned long *flags) +static inline void grq_lock_irqsave(unsigned long *flags) __acquires(grq.lock) - __acquires(grq.rwlock) { raw_spin_lock_irqsave(&grq.lock, *flags); - grq_read_lock(); } static inline void grq_upgrade_rwlock(void) - __releases(grq.rwlock) __acquires(grq.rwlock) { - grq_read_unlock(); grq_write_lock(); } @@ -611,11 +599,9 @@ static inline void grq_wunlock_irqrestor raw_spin_unlock_irqrestore(&grq.lock, *flags); } -static inline void grq_uunlock_irqrestore(unsigned long *flags) - __releases(grq.rwlock) +static inline void grq_unlock_irqrestore(unsigned long *flags) __releases(grq.lock) { - grq_read_unlock(); raw_spin_unlock_irqrestore(&grq.lock, *flags); } @@ -639,11 +625,10 @@ static inline struct rq } static inline struct rq -*task_grq_ulock(struct task_struct *p, unsigned long *flags) +*task_grq_lock(struct task_struct *p, unsigned long *flags) __acquires(grq.lock) - __acquires(grq.rwlock) { - grq_ulock_irqsave(flags); + grq_lock_irqsave(flags); return task_rq(p); } @@ -657,11 +642,10 @@ static inline struct rq return rq; } -static inline struct rq *task_grq_ulock_irq(struct task_struct *p) +static inline struct rq *task_grq_lock_irq(struct task_struct *p) __acquires(grq.lock) - __acquires(grq.rwlock) { - grq_ulock_irq(); + grq_lock_irq(); return task_rq(p); } @@ -672,11 +656,10 @@ static inline void task_grq_wunlock_irq( grq_wunlock_irq(); } -static inline void task_grq_uunlock_irq(void) - __releases(grq.rwlock) +static inline void task_grq_unlock_irq(void) __releases(grq.lock) { - grq_uunlock_irq(); + grq_unlock_irq(); } static inline void task_grq_runlock(unsigned long *flags) @@ -692,11 +675,10 @@ static inline void task_grq_wunlock(unsi grq_wunlock_irqrestore(flags); } -static inline void task_grq_uunlock(unsigned long *flags) - __releases(grq.rwlock) +static inline void task_grq_unlock(unsigned long *flags) __releases(grq.lock) { - grq_uunlock_irqrestore(flags); + grq_unlock_irqrestore(flags); } /** @@ -736,11 +718,10 @@ static inline struct rq *__task_grq_wloc return task_rq(p); } -static inline struct rq *__task_grq_ulock(struct task_struct *p) +static inline struct rq *__task_grq_lock(struct task_struct *p) __acquires(grq.lock) - __acquires(grq.rwlock) { - grq_ulock(); + grq_lock(); return task_rq(p); } @@ -751,11 +732,10 @@ static inline void __task_grq_wunlock(vo grq_wunlock(); } -static inline void __task_grq_uunlock(void) - __releases(grq.rwlock) +static inline void __task_grq_unlock(void) __releases(grq.lock) { - grq_uunlock(); + grq_unlock(); } /* @@ -1751,7 +1731,7 @@ static bool try_to_wake_up(struct task_s * No need to do time_lock_grq as we only need to update the rq clock * if we activate the task */ - rq = task_grq_ulock(p, &flags); + rq = task_grq_lock(p, &flags); cpu = task_cpu(p); /* state is a volatile long, どうして、分からない */ @@ -1773,7 +1753,7 @@ out_unlock: if (rwupgrade) task_grq_wunlock(&flags); else - task_grq_uunlock(&flags); + task_grq_unlock(&flags); ttwu_stat(p, cpu, wake_flags); @@ -1912,7 +1892,7 @@ void sched_fork(struct task_struct *p) * value. rq->rq_deadline is only modified within schedule() so it * is always equal to current->deadline. */ - rq = task_grq_ulock_irq(curr); + rq = task_grq_lock_irq(curr); if (likely(rq->rq_time_slice >= RESCHED_US * 2)) { rq->rq_time_slice /= 2; p->time_slice = rq->rq_time_slice; @@ -1933,7 +1913,7 @@ void sched_fork(struct task_struct *p) if (unlikely(rwupgrade)) task_grq_wunlock_irq(); else - task_grq_uunlock_irq(); + task_grq_unlock_irq(); out: put_cpu(); } @@ -2703,7 +2683,7 @@ unsigned long long task_delta_exec(struc struct rq *rq; u64 ns = 0; - rq = task_grq_ulock(p, &flags); + rq = task_grq_lock(p, &flags); if (p == rq->curr) { grq_upgrade_rwlock(); update_clocks(rq); @@ -2712,7 +2692,7 @@ unsigned long long task_delta_exec(struc ns = 0; task_grq_wunlock(&flags); } else - task_grq_uunlock(&flags); + task_grq_unlock(&flags); return ns; } @@ -2728,7 +2708,7 @@ unsigned long long task_sched_runtime(st u64 ps, ns = 0; struct rq *rq; - rq = task_grq_ulock(p, &flags); + rq = task_grq_lock(p, &flags); ps = p->sched_time; if (p == rq->curr) { grq_upgrade_rwlock(); @@ -2738,7 +2718,7 @@ unsigned long long task_sched_runtime(st ns = 0; task_grq_wunlock(&flags); } else - task_grq_uunlock(&flags); + task_grq_unlock(&flags); ps += ns; return ps; @@ -4381,13 +4361,13 @@ recheck: * To be able to change p->policy safely, the grunqueue lock must be * held. */ - rq = __task_grq_ulock(p); + rq = __task_grq_lock(p); /* * Changing the policy of the stop threads its a very bad idea */ if (p == rq->stop) { - __task_grq_uunlock(); + __task_grq_unlock(); raw_spin_unlock_irqrestore(&p->pi_lock, flags); return -EINVAL; } @@ -4397,7 +4377,7 @@ recheck: */ if (unlikely(policy == p->policy && (!is_rt_policy(policy) || param->sched_priority == p->rt_priority))) { - __task_grq_uunlock(); + __task_grq_unlock(); raw_spin_unlock_irqrestore(&p->pi_lock, flags); return 0; } @@ -4405,7 +4385,7 @@ recheck: /* recheck policy now with rq lock held */ if (unlikely(oldpolicy != -1 && oldpolicy != p->policy)) { policy = oldpolicy = -1; - __task_grq_uunlock(); + __task_grq_unlock(); raw_spin_unlock_irqrestore(&p->pi_lock, flags); goto recheck; } @@ -4867,7 +4847,7 @@ bool __sched yield_to(struct task_struct struct rq *rq; rq = this_rq(); - grq_ulock_irqsave(&flags); + grq_lock_irqsave(&flags); if (task_running(p) || p->state) goto out_unlock; @@ -4885,7 +4865,7 @@ out_unlock: grq_wunlock_irqrestore(&flags); schedule(); } else - grq_uunlock_irqrestore(&flags); + grq_unlock_irqrestore(&flags); return yielded; } @@ -5276,7 +5256,7 @@ int set_cpus_allowed_ptr(struct task_str struct rq *rq; int ret = 0; - rq = task_grq_ulock(p, &flags); + rq = task_grq_lock(p, &flags); if (cpumask_equal(tsk_cpus_allowed(p), new_mask)) goto out; @@ -5318,7 +5298,7 @@ out: if (rwupgrade) task_grq_wunlock(&flags); else - task_grq_uunlock(&flags); + task_grq_unlock(&flags); if (running_wrong) _cond_resched();