SUMMARY Building and running kwin on musl will not get realtime priorities since sched_setscheduler in musl does nothing. https://www.openwall.com/lists/musl/2016/03/01/4 OBSERVED RESULT kwin running with normal priority EXPECTED RESULT kwin running with realtime priorities SOFTWARE/OS VERSIONS Linux/KDE Plasma: (available in About System) KDE Plasma Version: 6.1.80 KDE Frameworks Version: 6.4.0 Qt Version: 6.7.1 ADDITIONAL INFORMATION
From your link: The reason it doesn't do anything is that Linux does not provide a way to set scheduling parameters for a _process_, only for threads. The sched_setscheduler syscall is documented as taking a pid but actually takes a thread id and only operates on that thread. glibc just ignores this and provides sched_* functions that do the wrong thing. Fortunately there's an easy fix: use pthread_setschedparam, and pthread_self to get the pthread_t value you need to pass to it. --- That seems like an actionable task
Created attachment 171387 [details] fix-kwin-realtime-thread-musl.patch
that patch should work on both glibc and musl
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/6107
Git commit 5921be95d3bfcf239436681bc5fe7837c5cee203 by Vlad Zahorodnii. Committed on 16/07/2024 at 12:56. Pushed by vladz into branch 'master'. utils: Fix gaining realtime scheduling with musl sched_setscheduler() is implemented as a stub in musl that does nothing because Linux provides no way to set scheduling parameters per process. Use pthread_setschedparam() to change the scheduling parameters of the threads instead. M +2 -1 src/utils/realtime.cpp https://invent.kde.org/plasma/kwin/-/commit/5921be95d3bfcf239436681bc5fe7837c5cee203
Git commit 2b7882fbbc734101b097b7b7b019197386769eb1 by Vlad Zahorodnii. Committed on 17/07/2024 at 05:29. Pushed by vladz into branch 'Plasma/6.1'. utils: Fix gaining realtime scheduling with musl sched_setscheduler() is implemented as a stub in musl that does nothing because Linux provides no way to set scheduling parameters per process. Use pthread_setschedparam() to change the scheduling parameters of the threads instead. (cherry picked from commit 5921be95d3bfcf239436681bc5fe7837c5cee203) Co-authored-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org> M +2 -1 src/utils/realtime.cpp https://invent.kde.org/plasma/kwin/-/commit/2b7882fbbc734101b097b7b7b019197386769eb1