Page MenuHomeFreeBSD

linuxulator: Map scheduler priorities to Linux priorities
ClosedPublic

Authored by tijl on Feb 22 2020, 2:37 PM.
Referenced Files
Unknown Object (File)
Wed, Oct 30, 5:32 PM
Unknown Object (File)
Oct 21 2024, 3:58 AM
Unknown Object (File)
Oct 21 2024, 3:57 AM
Unknown Object (File)
Oct 21 2024, 3:55 AM
Unknown Object (File)
Oct 9 2024, 6:47 AM
Unknown Object (File)
Oct 3 2024, 9:21 AM
Unknown Object (File)
Oct 3 2024, 9:21 AM
Unknown Object (File)
Oct 3 2024, 9:20 AM

Details

Summary

Linux has a single priority level (0) for SCHED_OTHER and [1,99] for SCHED_FIFO and SCHED_RR. FreeBSD supports [0,31] for all scheduling policies. Programs are supposed to query the valid range using sched_get_priority_(min|max), but of course some programs assume the Linux values are valid.

This patch adds a sysctl compat.linux.map_sched_prio. When enabled sched_get_priority_(min|max) will return the Linux values and sched_setscheduler and sched_(get|set)param translate between FreeBSD and Linux values.

Because there are more Linux levels than FreeBSD levels, multiple Linux levels map to a single FreeBSD level, which means pre-emption might not happen as it does on Linux. So the sysctl allows to disable this behaviour. It is enabled by default because I think it is unlikely that anyone runs real-time software under Linux emulation on FreeBSD that critically relies on correct pre-emption.

This patch fixes FMOD, a commercial sound library used by several games. See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240043

Diff Detail

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