You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add SCHED_DEADLINE and SCHED_NORMAL constants to os module #127688
# deadline scheduling
# Set the current schedule to real-time schedule, To be precise, it
# is not real-time scheduling, but it is relatively real-time.
prio = os.sched_param(sched_priority=10)
os.sched_setscheduler(0, os.SCHED_DEADLINE, prio)
SCHED_NORMAL is the same as SCHED_OTHER.
But to run in the old linux, we can't remove SCHED_OTHER, even if it no longer exists in the current main branch.
But we still need to add SCHED_NORMAL, because SCHED_OTHER only exists in the old distribution.
changed the title [-]Add SCHED_DEADLINE and SCHED_NORMAL constants to `os` module[/-][+]Add `SCHED_DEADLINE` and `SCHED_NORMAL` constants to `os` module[/+]on Dec 6, 2024
I didn't find any official source saying it's OK to include linux/sched.h outside the kernel. Am I overthinking this?
What I mean is, yes.
Looking around, it seems like the kernel headers in linux/*.h are meant for the kernel
Typically, GCC searches using the following paths, assuming you haven’t changed them. Additionally, linux/*.h files are divided into kernel-space and user-space headers. Only when compiling a kernel module will it link to the kernel header files.
Activity
[-]Add SCHED_DEADLINE and SCHED_NORMAL constants to `os` module[/-][+]Add `SCHED_DEADLINE` and `SCHED_NORMAL` constants to `os` module[/+]encukou commentedon Dec 13, 2024
I don't have
SCHED_NORMALon my Fedora 41. I'd like to test with a system that has it; are you aware of one?rruuaanng commentedon Dec 14, 2024
Can you try running the following code?
SCHED_NORMALhas been present in Linux 2.6.12 and still exists in later versions.In pyrepl
ref:
https://github.com/torvalds/linux/blob/9ee1c939d1cb936b1f98e8d81aeffab57bae46ab/include/linux/sched.h#L132
my os:
Ubuntu 22.04.4 LTS (GNU/Linux 5.15.0-86-generic x86_64)Edit
etc. That was actually my mistake, we should have imported
linux/sched.h, notsched.h. Our existing posixmodule.c usessched.h.encukou commentedon Dec 16, 2024
Looking around, it seems like the kernel headers in
linux/*.hare meant for the kernel, rather than user-space programs -- e.g. from this LWN article:I didn't find any official source saying it's OK to include
linux/sched.houtside the kernel. Am I overthinking this?rruuaanng commentedon Dec 17, 2024
What I mean is, yes.
Typically, GCC searches using the following paths, assuming you haven’t changed them. Additionally, linux/*.h files are divided into kernel-space and user-space headers. Only when compiling a kernel module will it link to the kernel header files.
https://github.com/torvalds/linux/blob/f44d154d6e3d633d4c49a5d6aed8a0e4684ae25e/include/uapi/linux/sched.h#L114
You will find that the content of your
/usr/include/linux/sched.his almost the same as it.Edit
This may not be convincing as they are not exactly similar, but we import multiple
linux/*.hinposixmodule.cand I don't think it matters.gh-127688: Add `SCHED_DEADLINE` and `SCHED_NORMAL` constants to `os` …
encukou commentedon Dec 19, 2024
OK.
Merged, thank you for the contribution!
pythongh-127688: Add `SCHED_DEADLINE` and `SCHED_NORMAL` constants to…
pythongh-127688: Add `SCHED_DEADLINE` and `SCHED_NORMAL` constants to…