Browse Source

Merge pull request #85 from terencode/master

Add with-pam-group meson option
Alex Smith 6 years ago
parent
commit
60c722d252
4 changed files with 19 additions and 2 deletions
  1. 2 2
      README.md
  2. 1 0
      data/10-gamemode.conf.in
  3. 13 0
      meson.build
  4. 3 0
      meson_options.txt

+ 2 - 2
README.md

@@ -7,7 +7,8 @@ GameMode was designed primarily as a stop-gap solution to problems with the Inte
 
 GameMode can leverage support for soft real time mode if the running kernel supports `SCHED_ISO`. This adjusts the scheduling of the game to real time without sacrificing system stability by starving other processes.
 
-GameMode adjusts the nice priority of games to -4 by default to give it a slight IO and CPU priority over other background processes. This only works if your user is permitted to adjust priorities within the limits configured by PAM. See `/etc/security/limits.conf`.
+GameMode adjusts the nice priority of games to -4 by default to give it a slight IO and CPU priority over other background processes. This only works if your user is permitted to adjust priorities within the limits configured by PAM. GameMode can be configured to take care of it by passing `with-pam-group=group` to the build options where `group` is a group your user needs to be part of.
+For more information, see `/etc/security/limits.conf`.
 
 Please take note that some games may actually run seemingly slower with `SCHED_ISO` if the game makes use of busy looping while interacting with the graphic driver. The same may happen if you apply too strong nice values. This effect is called priority inversion: Due to the high priority given to busy loops, there may be too few resources left for the graphics driver. Thus, sane defaults were chosen to not expose this effect on most systems. Part of this default is a heuristic which automatically turns off `SCHED_ISO` if GameMode detects three or less CPU cores. Your experience may change based on using GL threaded optimizations, CPU core binding (taskset), the graphic driver, or different CPU architectures. If you experience bad input latency or inconsistent FPS, try switching these configurations on or off first and report back. `SCHED_ISO` comes with a protection against this effect by falling back to normal scheduling as soon as the `SCHED_ISO` process uses more than 70% avarage across all CPU cores. This default value can be adjusted outside of the scope of GameMode (it's in `/proc/sys/kernel/iso_cpu`). This value also protects against compromising system stability, do not set it to 100% as this would turn the game into a full real time process, thus potentially starving all other OS components from CPU resources.
 
@@ -161,4 +162,3 @@ See the [contributors](https://github.com/FeralInteractive/gamemode/graphs/contr
 Copyright © 2018 Feral Interactive
 
 GameMode is available under the terms of the BSD 3-Clause License (Revised)
-

+ 1 - 0
data/10-gamemode.conf.in

@@ -0,0 +1 @@
+@@LIMITSGROUP@ - nice -10

+ 13 - 0
meson.build

@@ -55,6 +55,19 @@ if with_systemd == true
     endif
 endif
 
+with_limits_conf = get_option('with-pam-group')
+if with_limits_conf != ''
+  ldata = configuration_data()
+  ldata.set('LIMITSGROUP', with_limits_conf)
+  # Install the limits.d configuration file
+  configure_file(
+      input: 'data/10-gamemode.conf.in',
+      output: '10-gamemode.conf',
+      configuration: ldata,
+      install_dir: '/etc/security/limits.d',
+  )
+endif
+
 # Set the dbus path as appropriate.
 path_dbus_service_dir = get_option('with-dbus-service-dir')
 if path_dbus_service_dir == ''

+ 3 - 0
meson_options.txt

@@ -1,5 +1,8 @@
 option('with-systemd', type: 'boolean', description: 'Use systemd support (unit, etc)', value: 'true')
 
+# limits.d
+option('with-pam-group', type: 'string', description: 'Install the limits.d configuration file to allow renicing as an unpriviledged user being part of the specified group')
+
 # systemd specific
 option('with-systemd-user-unit-dir', type: 'string', description: 'Explicitly set the systemd user unit directory')