Page MenuHomeFreeBSD

Allow rtprio_thread to operate on threads of any process
ClosedPublic

Authored by val_packett.cool on Nov 10 2020, 12:44 AM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 25 2023, 7:06 AM
Unknown Object (File)
Dec 22 2023, 11:01 PM
Unknown Object (File)
Dec 18 2023, 3:16 PM
Unknown Object (File)
Nov 19 2023, 4:07 AM
Unknown Object (File)
Nov 19 2023, 2:22 AM
Unknown Object (File)
Nov 19 2023, 2:21 AM
Unknown Object (File)
Nov 19 2023, 1:55 AM
Unknown Object (File)
Aug 7 2023, 7:20 PM
Subscribers

Details

Summary

Multimedia daemons like PulseAudio and PipeWire, running as a regular user, want realtime priority on some of their threads, and they support RealtimeKit https://github.com/heftig/rtkit for that, which is a clever daemon that manages per-thread realtime priority (of all its clients) carefully.

On Linux, rtkit simply uses the POSIX.1b sched_setscheduler call with a thread ID and it just works (I think because Linux threads are just boneless processes, i.e. processes sharing an address space).
In 2006 support for thread IDs in POSIX.1b calls was added FreeBSD… and removed 2 days later to avoid mixing processes and threads (argh, inconvenient).

Well, the syscall that *is* supposed to work for some reason only works for threads of the current process. I'd like to remove this limitation (which was not even advertised on the manpage), because it prevents anything like rtkit from working.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This looks like a limitation which is a holdover from previous state:

/*
 * Though lwpid is unique, only current process is supported
 * since there is no efficient way to look up a LWP yet.
 */

I'll sleep on it and probably commit tomorrow.

This revision was not accepted when it landed; it landed in state Needs Review.Nov 10 2020, 6:11 PM
This revision was automatically updated to reflect the committed changes.