remove preempt in do_sched_yield
RFC 1/1 remove preempt in do_sched_yield
I see do_sched_yield's irq disable cover preempt disable. In this function, I think preempt op may not work, or it may have some special effect ? Thanks.
Signed-off-by Wang You <[email protected]>
--- kernel/sched/core.c | 3 --- 1 file changed, 3 deletions(-)
kernel/sched/core.c +0 -3
@@ -8487,10 +8487,7 @@ static void do_sched_yield(void)schedstat_inc (rq->yld_count); current->sched_class->yield_task (rq); - -preempt_disable ();rq_unlock_irq (rq, &rf); -sched_preempt_enable_no_resched ();schedule (); }
Signature · 1 line
2.20.1
Steven Rostedt
reviewerQuoted 3 lines · On Wed, 23 Aug 2023 18:07:05 +0800 Wang You <[email protected]> wrote:
I see do_sched_yield's irq disable cover preempt disable. In this function, I think preempt op may not work, or it may have some special effect ? Thanks.
Why would it not work?
Quoted 11 lines
Signed-off-by Wang You <[email protected]>--- kernel/sched/core.c | 3 --- 1 file changed, 3 deletions(-)kernel/sched/core.c +0
-0
kernel/sched/core.c static void do_sched_yield(void) · line 8493
Quoted 7 lines
kernel/sched/core.c +0
-3@@ -8487,10 +8487,7 @@ static void do_sched_yield(void)schedstat_inc (rq->yld_count); current->sched_class->yield_task (rq); - -preempt_disable ();rq_unlock_irq (rq, &rf); -sched_preempt_enable_no_resched ();
The point of this is if an interrupt triggers here and NEED_RESCHED is set, then it will call schedule and possibly schedule out the task. When it gets scheduled back in, the first thing it will do is to call schedule again. The above code you deleted removes the spurious schedule.
-- Steve
Quoted 3 lines
kernel/sched/core.c +0
-0schedule (); }