diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 6859ea1d5c0492b33e647da9c642c1fd6d726485..a4893fac2147d2d43bf8b3caf86bd3f6d8ae3f38 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -4933,9 +4933,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 6cc08dc8008f82e64dc94f220acd80281dd09289..17245cf25d449ec1017cc9eb0516f21a17cf4287 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1150,6 +1150,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,