os/kernel/sched: Refine round-robin scheduling behavior on SMP - #7465
os/kernel/sched: Refine round-robin scheduling behavior on SMP#7465hyunjongkim123 wants to merge 1 commit into
Conversation
463d63c to
f72f9ac
Compare
seokhun-eom24
left a comment
There was a problem hiding this comment.
We need to update sched_timerexpiration.c file too.
f7100cf to
2da9fcf
Compare
| if (rtcb->flink && rtcb->flink->sched_priority >= rtcb->sched_priority) { | ||
| do_reprioritize = true; | ||
| } |
There was a problem hiding this comment.
Could you please let me know why checking this condition is needed?
| * or higher priority task can run on this CPU. | ||
| */ | ||
|
|
||
| if (sched_islocked_global() || irq_cpu_locked(cpu)) { |
There was a problem hiding this comment.
@hyunjongkim123 : I think it should be irq_cpu_locked(this_cpu()) instead of irq_cpu_locked(cpu).
Since only CPU0 receives the timer interrupt and when it tries to examine the CPU1 tasks during its tick handler
irq_cpu_locked(cpu1) always return true because cpu0 is already inside the critical section.
Hence, round robin scheduling will never run for cpu1.
| @@ -132,6 +135,45 @@ static inline void sched_process_timeslice(int cpu) | |||
|
|
|||
| rtcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL); | |||
There was a problem hiding this comment.
@hyunjongkim123 : timeslice is reset here whereas the schedulr lock check is added later (at line 153).
If the scheduler is locked then task gets a full new timeslice instead of giving up CPU.
The lockcount checking case just above keeps the counter as it is, instead of resetting it.
Can we do the same here - check the lock before the timeslice reset?
Refine round-robin scheduling behavior on SMP systems.
2da9fcf to
7346e01
Compare
g_assignedtasksandg_readytorunfor SMP round-robin scheduling.