Skip to content

Commit

Permalink
chore: Setup system76-scheduler 2.0 for Fedora copr build system
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleGospo committed Apr 27, 2023
1 parent 97a8617 commit 4d362df
Show file tree
Hide file tree
Showing 7 changed files with 238 additions and 9 deletions.
12 changes: 12 additions & 0 deletions .github/pull.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: "1"
rules:
- base: master
upstream: pop-os:master
mergeMethod: merge
mergeUnstable: false
assignees:
- KyleGospo
reviewers:
- KyleGospo
conflictReviewers:
- KyleGospo
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
# System76 Scheduler
![Build Status](https://copr.fedorainfracloud.org/coprs/kylegospo/system76-scheduler/package/system76-scheduler/status_image/last_build.png?)

Scheduling service which optimizes Linux's CPU scheduler and automatically assigns process priorities for improved desktop responsiveness. Low latency CPU scheduling will be activated automatically when on AC, and the default scheduling latencies set on battery. Processes are regularly sweeped and assigned process priorities based on configuration files. When combined with [pop-shell](https://github.com/pop-os/shell/), foreground processes and their sub-processes will be given higher process priority.
## Releases

You can get releases for Fedora, RHEL, CentOS, OpenSUSE, and OpenMandriva from my [Copr](https://copr.fedorainfracloud.org/coprs/kylegospo/system76-scheduler/).

See the below table for changes needed depending on your desktop environment.

| Desktop Environment | Support |
|---------------------|------------------------------------------------------------------------------|
| GNOME | [Extension](https://extensions.gnome.org/extension/4854/system76-scheduler/) |
| KDE | [Kwin Script](https://store.kde.org/p/1789957) |
| Pop Shell | Built-in |

## About

Scheduling service which optimizes Linux's CPU scheduler and automatically assigns process priorities for improved desktop responsiveness. Low latency CPU scheduling will be activated automatically when on AC, and the default scheduling latencies set on battery. Processes are regularly sweeped and assigned process priorities based on configuration files. When combined with a supported desktop environment, foreground processes and their sub-processes will be given higher process priority.

These changes result in a noticeable improvement in the experienced smoothness and performance of applications and games. The improved responsiveness of applications is most noticeable on older systems with budget hardware, whereas games will benefit from higher framerates and reduced jitter. This is because background applications and services will be given a smaller portion of leftover CPU budget after the active process has had the most time on the CPU.

Expand Down
12 changes: 8 additions & 4 deletions data/com.system76.Scheduler.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy user="root">
<allow own="com.system76.Scheduler"/>
<policy context="default">
<allow send_destination="com.system76.Scheduler"/>
<allow receive_sender="com.system76.Scheduler"/>
</policy>
<policy context="default">
<policy group="sudo">
<allow send_destination="com.system76.Scheduler"/>
<allow receive_sender="com.system76.Scheduler"/>
</policy>
<policy user="root">
<allow own="com.system76.Scheduler"/>
<allow send_destination="com.system76.Scheduler"/>
<allow receive_sender="com.system76.Scheduler"/>
</policy>
</busconfig>
</busconfig>
2 changes: 1 addition & 1 deletion data/config.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cfs-profiles enable=true {
default latency=6 nr-latency=8 wakeup-granularity=1.0 bandwidth-size=5 preempt="voluntary"

// Zen CFS parameters that make the desktop more responsive
responsive latency=4 nr-latency=10 wakeup-granularity=0.5 bandwidth-size=3 preempt="full"
responsive latency=3 nr-latency=10 wakeup-granularity=0.5 bandwidth-size=3 preempt="full"
}

// Monitors and applies process priority adjustments
Expand Down
103 changes: 103 additions & 0 deletions data/fedora.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
assignments {
recording {
amsynth
easyeffects
jamesdsp
jitsi
mumble
obs
teams
wireplumber
zoom
bitwig-studio
fx_cast_bridge
include name="Bitwig*"
}

games {
lutris
steam
vrcompositor
vrdashboard
vrmonitor
vrserver
include descends="steam"
include descends="lutris"
}

desktop-environment {
cosmic-comp
gnome-shell
i3wm
kwin
sway
Xorg
}

session-services {
include parent="gnome-session-binary"
include parent="gvfsd"
}

package-manager {
include name="apt-*"
include name="dpkg-*"
apt
dpkg
flatpak
fwupd
packagekitd
update-initramfs
apk
dnf
pacman
include name="rpm-*"
rpm
swupd
yay
yum
zypper
}

batch {
include name="sbuild-*"
"7z"
"7za"
"7zr"
ar
boinc
c++
cargo
clang
cmake
cpp
FAHClient
FAHCoreWrapper
fossilize-replay
g++
gcc
gradle
javac
ld
lld
make
mold
mvn
ninja
rust-analyzer
rustc
sbuild
tar
tracker-miner-fs-3
unrar
zip
rslsync
}
}

exceptions {
preload
include name="fig_*"
fig
vanilla-first-setup
}
8 changes: 5 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ binary := 'system76-scheduler'
id := 'com.system76.Scheduler'

rootdir := ''
unitdir := ''
prefix := '/usr'
sysconfdir := '/etc'

bindir := clean(rootdir / prefix) / 'bin'
libdir := clean(rootdir / prefix) / 'lib'
systemd := rootdir + unitdir
confdir := clean(rootdir / sysconfdir)

target-bin := bindir / binary
Expand Down Expand Up @@ -43,9 +45,9 @@ check-json: (check '--message-format=json')
install:
mkdir -p {{confdir}}/system76-scheduler/process-scheduler
install -Dm0644 data/config.kdl {{confdir}}/system76-scheduler/config.kdl
install -Dm0644 data/pop_os.kdl {{confdir}}/system76-scheduler/process-scheduler/pop_os.kdl
install -Dm0644 data/fedora.kdl {{confdir}}/system76-scheduler/process-scheduler/fedora.kdl
install -Dm0755 target/release/{{binary}} {{target-bin}}
install -Dm0644 data/{{id}}.service {{libdir}}/systemd/system/{{id}}.service
install -Dm0644 data/{{id}}.service {{systemd}}/{{id}}.service
install -Dm0644 data/{{id}}.conf {{confdir}}/dbus-1/system.d/{{id}}.conf

# Uninstalls everything (requires same arguments as given to install)
Expand All @@ -70,4 +72,4 @@ vendor:
[private]
vendor-extract:
rm -rf vendor
tar pxf vendor.tar
tar pxf vendor.tar
93 changes: 93 additions & 0 deletions system76-scheduler.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Name: system76-scheduler
Version: 2.{{{ git_dir_version }}}
Release: 1%{?dist}
Summary: System76 Scheduler daemon - Auto-configure CFS and process priorities for improved desktop responsiveness

License: MPLv2.0
URL: https://github.com/KyleGospo/system76-scheduler

VCS: {{{ git_dir_vcs }}}
Source: {{{ git_dir_pack }}}

# Realtime priority if bcc-tools is installed. Not available on OpenMandriva.
%if ! 0%{?mdkversion}
Requires: bcc-tools
%endif

# No just package on EPEL, OpenSUSE, or OpenMandriva
%{?fedora:BuildRequires: just}
BuildRequires: rust
BuildRequires: cargo
BuildRequires: pipewire-devel
BuildRequires: llvm-devel
BuildRequires: clang-libs
BuildRequires: clang-devel
BuildRequires: systemd-rpm-macros
# Required packages to build just on OpenMandriva
%if 0%{?mdkversion}
BuildRequires: glibc-devel
BuildRequires: glibc-static-devel
%endif

%description
Scheduling service which optimizes Linux's CPU scheduler and automatically assigns process priorities for improved desktop responsiveness. Low latency CPU scheduling will be activated automatically when on AC, and the default scheduling latencies set on battery. Processes are regularly sweeped and assigned process priorities based on configuration files. When combined with a supported desktop environment, foreground processes and their sub-processes will be given higher process priority.

These changes result in a noticeable improvement in the experienced smoothness and performance of applications and games. The improved responsiveness of applications is most noticeable on older systems with budget hardware, whereas games will benefit from higher framerates and reduced jitter. This is because background applications and services will be given a smaller portion of leftover CPU budget after the active process has had the most time on the CPU.

# Disable debug packages
%define debug_package %{nil}
%if 0%{?mdkversion}
# FIXME this is a workaround for some debug files being created on OpenMandriva despite debug_package being set to %{nil}
%define _unpackaged_files_terminate_build 0
%endif

# Set path to just
%if ! 0%{?fedora}
# Cargo install path on EPEL, OpenSUSE, or OpenMandriva
%define justpath /builddir/.cargo/bin/just
%else
%define justpath just
%endif

%prep
{{{ git_dir_setup_macro }}}

# This will invoke `just` command in the directory with the extracted sources.
%build
%if ! 0%{?fedora}
cargo install just
%endif
%{justpath} execsnoop=/usr/share/bcc/tools/execsnoop build-release

# This will copy the files generated by the `just` command above into
# the installable rpm package.
%install
%{justpath} rootdir=%{buildroot} unitdir=%{_unitdir} sysconfdir=%{_sysconfdir} install

# Do post-installation
%post
%systemd_post com.system76.Scheduler.service

# Do before uninstallation
%preun
%systemd_preun com.system76.Scheduler.service

# Do after uninstallation
%postun
%systemd_postun_with_restart com.system76.Scheduler.service

# This lists all the files that are included in the rpm package and that
# are going to be installed into target system where the rpm is installed.
%files
%license LICENSE
%doc README.md
%{_bindir}/system76-scheduler
%{_sysconfdir}/system76-scheduler/config.kdl
%{_sysconfdir}/system76-scheduler/process-scheduler/fedora.kdl
%{_unitdir}/com.system76.Scheduler.service
%{_sysconfdir}/dbus-1/system.d/com.system76.Scheduler.conf

# Finally, changes from the latest release of your application are generated from
# your project's Git history. It will be empty until you make first annotated Git tag.
%changelog
{{{ git_dir_changelog }}}

0 comments on commit 4d362df

Please sign in to comment.