sched: Removed redundant set_current_state in "yield"
PATCH 1/1 sched: Removed redundant set_current_state in "yield"
Removed redundant setting current task state to TASK_RUNNING.
During yield process will always remains in TASK_RUNNING state.
Process state of yielded process will not change from TASK_RUNNING, so it does not make sense setting the process state again to TASK_RUNNING (TASK_RUNNING -> TASK_RUNNING).
--- kernel/sched/core.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
kernel/sched/core.c +0 -1
@@ -4624,7 +4624,6 @@ EXPORT_SYMBOL(__cond_resched_softirq);*/ void __sched yield(void) { -set_current_state (TASK_RUNNING );sys_sched_yield (); }EXPORT_SYMBOL (yield);
Signature · 1 line
1.7.3.4
Quoted 3 lines · Sasikantha babu
Removed redundant setting current task state to
TASK_RUNNING.During yield process will always remains in
TASK_RUNNINGstate.
Uhm, no, if you call yield() with !TASK_RUNNING you'll block and need a proper wakeup. That is, you can in fact abuse yield() as schedule().
Quoted 2 lines
Process state of yielded process will not change from
TASK_RUNNING, so it does not make sense setting the process state again toTASK_RUNNING(TASK_RUNNING->TASK_RUNNING).
No real objections, but have you tested/verified that all users are indeed unaffected by this change?
Quoted 17 lines
Signed-off-by Sasikantha babu <[email protected]>--- kernel/sched/core.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)kernel/sched/core.c +0
-1@@ -4624,7 +4624,6 @@ EXPORT_SYMBOL(__cond_resched_softirq);*/ void __sched yield(void) { -set_current_state (TASK_RUNNING );sys_sched_yield (); }EXPORT_SYMBOL (yield);
Quoted 7 lines · Peter Zijlstra
Quoted 3 lines · Sasikantha babu
Removed redundant setting current task state to
TASK_RUNNING.During yield process will always remains in
TASK_RUNNINGstate.Uhm, no, if you call
yield()with !TASK_RUNNING you'll block and need a proper wakeup. That is, you can in fact abuseyield()asschedule().
With the current code even if we call yield with !TASK_RUNNING, we are setting it
back to TASK_RUNNING in yield. is this the expected behavior?.
void __sched yield(void)
{
set_current_state(TASK_RUNNING);
sys_sched_yield();}
In the code I could not find yield was called with !TASK_RUNNING.
Quoted 6 lines
Quoted 3 lines
Process state of yielded process will not change from
TASK_RUNNING, so it does not make sense setting the process state again toTASK_RUNNING(TASK_RUNNING->TASK_RUNNING).No real objections, but have you tested/verified that all users are indeed unaffected by this change?
I did minimal testing on changes (Could not able to test all
scenarios, suggest me if there is anyway to test all cases) and
verified none of the code path is going affected by this change.
Quoted 21 lines
Quoted 18 lines
Signed-off-by Sasikantha babu <[email protected]>---
kernel/sched/core.c | 1 -1 files changed, 0 insertions(+), 1 deletions(-)kernel/sched/core.c +0
-1@@ -4624,7 +4624,6 @@ EXPORT_SYMBOL(__cond_resched_softirq);*/ void __sched yield(void) { - set_current_state(TASK_RUNNING); sys_sched_yield(); } EXPORT_SYMBOL(yield);