-
-
Notifications
You must be signed in to change notification settings - Fork 881
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
Request SCHED_RR using CAP_SYS_NICE and add Python to nix dev shell #2690
Conversation
why |
It makes Hyprland more responsive when the computer is under CPU stress, and python is required because Example: $ nix develop
$ meson setup build
# ...
| -- Could NOT find Python3 (missing: Python3_EXECUTABLE Interpreter)
| Building itab.c/itab.h...
| -- Configuring done (1.3s)
| CMake Error at libudis86/CMakeLists.txt:30 (add_library):
| Cannot find source file:
| itab.c
| Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h
| .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc
| CMake Error at libudis86/CMakeLists.txt:30 (add_library):
| No SOURCES given to target: libudis86
# ... https://blog.martin-graesslin.com/blog/2017/09/kwinwayland-goes-real-time/ |
Replacing --- a/src/init/initHelpers.cpp
+++ b/src/init/initHelpers.cpp
@@ -5,11 +5,23 @@ bool Init::isSudo() {
}
void Init::gainRealTime() {
-#ifdef SCHED_RESET_ON_FORK
const int minPrio = sched_get_priority_min(SCHED_RR);
sched_param param = {.sched_priority = minPrio};
+#ifdef SCHED_RESET_ON_FORK
if (pthread_setschedparam(pthread_self(), SCHED_RR | SCHED_RESET_ON_FORK, ¶m))
Debug::log(WARN, "Failed to change process scheduling strategy");
+#else
+ if (pthread_setschedparam(pthread_self(), SCHED_RR, ¶m)) {
+ Debug::log(WARN, "Failed to change process scheduling strategy");
+ return;
+ }
+
+ pthread_atfork(NULL, NULL, []() {
+ struct sched_param param = {.sched_priority = 0};
+
+ if (pthread_setschedparam(pthread_self(), SCHED_OTHER, ¶m))
+ Debug::log(WARN, "Failed to reset process scheduling strategy");
+ });
#endif
}
\ No newline at end of file |
hm, I think that if-guard |
Up to @vaxerski. |
I don't care |
09bd49b
to
ce9c5fd
Compare
whats the status on this? ready or not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SCHED_RR
part looks OK. I'm not familar with Nix to review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flake lgtm
Describe your PR, what does it fix/add?
python3
dep to nix developSCHED_RR
using pthreadIs there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)
Also require the maintainers to add
SYS_CAP_NICE
capability to the packageIs it ready for merging, or does it need work?
I don't think that adding
python3
directly into devShell is a good solution, but, works.