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

Add fix to thread scheduling API #415

Merged
merged 4 commits into from
Apr 28, 2024
Merged

Add fix to thread scheduling API #415

merged 4 commits into from
Apr 28, 2024

Conversation

erlingrj
Copy link
Collaborator

@erlingrj erlingrj commented Apr 26, 2024

Actually there were several mistakes in the original merge. It was not tested well enough and that's on me. I think we really need to add some tests for this API. A problem is that the program needs privileges to change its own scheduling policy and priority. I am not sure how easy it will be to do this in CI. But maybe not that hard.

Fixes:

  • We need to initialize the priority to something valid when setting the scheduling policy. To avoid duplicating the logic of translating it from LF priority range to target platform priority range, I initially set it to max, and then call lf_thread_set_priority.
  • There was a mistake in the function mapping the LF priority range into the target priority range. I am using integers for that, might be better with floats..
  • Actually forward the pthread error codes. A problem is that we make several syscalls so you wont know exactly which failed.

@erlingrj erlingrj marked this pull request as draft April 26, 2024 16:30
@erlingrj erlingrj marked this pull request as ready for review April 26, 2024 17:01
@lhstrh lhstrh requested a review from elgeeko1 April 26, 2024 20:28
Copy link
Member

@lhstrh lhstrh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@lhstrh lhstrh added this pull request to the merge queue Apr 28, 2024
Merged via the queue into main with commit b4bdaf8 Apr 28, 2024
47 of 50 checks passed
@erlingrj erlingrj deleted the thread-sched-fix branch May 6, 2024 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants