mirror of
https://github.com/swaywm/sway.git
synced 2025-11-07 13:29:56 -05:00
realtime: request SCHED_RR using CAP_SYS_NICE
Try to gain SCHED_RR (round-robin) realtime scheduling privileges before starting the server. This requires CAP_SYS_NICE on Linux systems. We additionally register a pthread_atfork callback which resets the scheduling class back to SCHED_OTHER (the Linux system default). Due to CAP_SYS_NICE, setting RLIMIT_RTPRIO has no effect on the process as documented within man 7 sched (from Linux): Privileged (CAP_SYS_NICE) threads ignore the RLIMIT_RTPRIO limit; as with older kernels, they can make arbitrary changes to scheduling policy and priority. See getrlimit(2) for further information on RLIMIT_RTPRIO Note that this requires the sway distribution packagers to set the CAP_SYS_NICE capability on the sway binary. Supersedes #6992
This commit is contained in:
parent
3f600565e4
commit
a3a82efbf6
4 changed files with 45 additions and 0 deletions
|
|
@ -413,6 +413,8 @@ int main(int argc, char **argv) {
|
|||
goto shutdown;
|
||||
}
|
||||
|
||||
set_rr_scheduling();
|
||||
|
||||
if (!server_start(&server)) {
|
||||
sway_terminate(EXIT_FAILURE);
|
||||
goto shutdown;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue