Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

freertos: fix multicore scheduler (IDFGH-5635) #7351

Closed
wants to merge 2 commits into from
Closed

freertos: fix multicore scheduler (IDFGH-5635) #7351

wants to merge 2 commits into from

Conversation

negativekelvin
Copy link
Contributor

This is a quick proposal to fix the issues described below. Please review as I can't claim this is well thought out or fully tested.

ToDo: This scheduler doesn't correctly implement the round-robin scheduling as done in the single-core
* FreeRTOS stack when multiple tasks have the same priority and are all ready; it just keeps grabbing the
* first one. ToDo: fix this.
* (Is this still true? if any, there's the issue with one core skipping over the processes for the other
* core, potentially not giving the skipped-over processes any time.)

@espressif-bot espressif-bot added the Status: Opened Issue is new label Aug 2, 2021
@github-actions github-actions bot changed the title freertos: proposal for changes to task scheduling freertos: proposal for changes to task scheduling (IDFGH-5635) Aug 2, 2021
@negativekelvin
Copy link
Contributor Author

negativekelvin commented Aug 3, 2021

These are the results of a test that creates 5 tasks on each core that share the idle priority and never block, relying only on time-slicing and preemption to share CPU.

Without patch:

Running tasks CPU usage:
 main                   2193789         <1%
IDLE            111006000               39%
test task 1-0   30180030                10%
test task 1-1   28000021                9%
test task 0-0   56530016                20%
test task 0-1   27990017                9%
test task 0-2   27990016                9%
test task 0-3   27990017                9%
test task 0-4   27990017                9%
test task 1-2   139960022               49%
test task 1-3   27990021                9%
test task 1-4   27990021                9%
IDLE            27559788                9%
ipc0            4871            <1%
esp_timer       19              <1%
ipc1            9897            <1%

With patch:

Running tasks CPU usage:
 main                   6513760         <1%
test task 0-1   135528372               16%
test task 1-1   134210021               16%
test task 0-4   137530021               16%
test task 1-2   134090021               16%
test task 0-2   134181705               16%
test task 1-0   137600029               16%
test task 0-3   135561710               16%
test task 1-3   134180021               16%
test task 1-4   134151800               16%
IDLE            137689790               16%
IDLE            135641756               16%
test task 0-0   133730769               16%
esp_timer       17              <1%
ipc1            9884            <1%
ipc0            4858            <1%

@Alvin1Zhang
Copy link
Collaborator

Thanks for your contribution.

@negativekelvin negativekelvin changed the title freertos: proposal for changes to task scheduling (IDFGH-5635) freertos: fix multicore scheduler (IDFGH-5635) Aug 11, 2021
@negativekelvin
Copy link
Contributor Author

@zikalino do you want to review this?

@negativekelvin
Copy link
Contributor Author

@Dazza0
Copy link
Collaborator

Dazza0 commented Nov 8, 2021

@negativekelvin Thank you for your contribution. The new "Best Effort Round Robin" scheduling in 8babb3b should now implement these changes.

@Dazza0 Dazza0 closed this Nov 8, 2021
@AxelLin
Copy link
Contributor

AxelLin commented Nov 8, 2021

@Dazza0

This PR was created quite long time ago.
I'm surprised you didn't merge it without any comments.
IMHO, this discourages people to contribute.

@espressif-bot espressif-bot added Resolution: Won't Do This will not be worked on Status: Done Issue is done internally and removed Status: Opened Issue is new labels Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Won't Do This will not be worked on Status: Done Issue is done internally
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants