Date: Thu, 5 Mar 2020 16:15:10 +0300 From: Yuri Pankov <ypankov@fastmail.com> To: Tijl Coosemans <tijl@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r358483 - head/sys/compat/linux Message-ID: <ee94ceba-55d4-27f7-9993-61aee0e8460b@fastmail.com> In-Reply-To: <202003011312.021DC4vh022404@repo.freebsd.org> References: <202003011312.021DC4vh022404@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Tijl Coosemans wrote: > Author: tijl > Date: Sun Mar 1 13:12:04 2020 > New Revision: 358483 > URL: https://svnweb.freebsd.org/changeset/base/358483 > > Log: > linuxulator: Map scheduler priorities to Linux priorities. > > On Linux the valid range of priorities for the SCHED_FIFO and SCHED_RR > scheduling policies is [1,99]. For SCHED_OTHER the single valid priority is > 0. On FreeBSD it is [0,31] for all 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 commit adds a tunable compat.linux.map_sched_prio. When enabled > sched_get_priority_(min|max) 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 tunable 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 fixes FMOD, a commercial sound library used by several games. > > PR: 240043 > Tested by: Alex S <iwtcex@gmail.com> > Reviewed by: dchagin > MFC after: 2 weeks > Differential Revision: https://reviews.freebsd.org/D23790 > > Modified: > head/sys/compat/linux/linux_misc.c > head/sys/compat/linux/linux_misc.h > > Modified: head/sys/compat/linux/linux_misc.c > ============================================================================== > --- head/sys/compat/linux/linux_misc.c Sun Mar 1 12:34:27 2020 (r358482) > +++ head/sys/compat/linux/linux_misc.c Sun Mar 1 13:12:04 2020 (r358483) > @@ -144,6 +144,11 @@ struct l_pselect6arg { > l_size_t ss_len; > }; > > +static bool map_sched_prio = true; > +SYSCTL_BOOL(_compat_linux, OID_AUTO, map_sched_prio, CTLFLAG_RDTUN, > + &map_sched_prio, 0, "Map scheduler priorities to Linux priorities " > + "(not POSIX compliant)"); I'm seeing the following in the log: sysctl_warn_reuse: can't re-use a leaf (compat.linux.map_sched_prio)! Should this be done for both linux and linux32 (when one exists) or made to install one time only?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ee94ceba-55d4-27f7-9993-61aee0e8460b>