diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 2befd2c4ce9e6bf3ca1b4cd78f4c914d192a896a..ef9c584a2cdf6f6965edd6dd42e825d5c17520c4 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -4974,9 +4974,7 @@ static void do_sched_yield(void) struct rq_flags rf; struct rq *rq; - local_irq_disable(); - rq = this_rq(); - rq_lock(rq, &rf); + rq = this_rq_lock_irq(&rf); schedstat_inc(rq->yld_count); current->sched_class->yield_task(rq); diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index a229cb82d96364165ffb39be71579e37b7f1b2ad..6248117b94d502865ff8faa0872abb8ca69d4284 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1146,6 +1146,18 @@ rq_unlock(struct rq *rq, struct rq_flags *rf) raw_spin_unlock(&rq->lock); } +static inline struct rq * +this_rq_lock_irq(struct rq_flags *rf) + __acquires(rq->lock) +{ + struct rq *rq; + + local_irq_disable(); + rq = this_rq(); + rq_lock(rq, rf); + return rq; +} + #ifdef CONFIG_NUMA enum numa_topology_type { NUMA_DIRECT,