From 4d362dfe14759fecfd93ddb14ac6aca4ee86ec13 Mon Sep 17 00:00:00 2001 From: Kyle Gospodnetich Date: Tue, 31 May 2022 09:38:33 -0700 Subject: [PATCH] chore: Setup system76-scheduler 2.0 for Fedora copr build system --- .github/pull.yml | 12 ++++ README.md | 17 ++++- data/com.system76.Scheduler.conf | 12 ++-- data/config.kdl | 2 +- data/fedora.kdl | 103 +++++++++++++++++++++++++++++++ justfile | 8 ++- system76-scheduler.spec | 93 ++++++++++++++++++++++++++++ 7 files changed, 238 insertions(+), 9 deletions(-) create mode 100644 .github/pull.yml create mode 100644 data/fedora.kdl create mode 100644 system76-scheduler.spec diff --git a/.github/pull.yml b/.github/pull.yml new file mode 100644 index 0000000..6a5c15c --- /dev/null +++ b/.github/pull.yml @@ -0,0 +1,12 @@ +version: "1" +rules: + - base: master + upstream: pop-os:master + mergeMethod: merge + mergeUnstable: false + assignees: + - KyleGospo + reviewers: + - KyleGospo + conflictReviewers: + - KyleGospo diff --git a/README.md b/README.md index 1bc68e2..7e8add3 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/data/com.system76.Scheduler.conf b/data/com.system76.Scheduler.conf index 77c59e9..3f49de4 100644 --- a/data/com.system76.Scheduler.conf +++ b/data/com.system76.Scheduler.conf @@ -2,13 +2,17 @@ "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> - - + - + + + + + + - \ No newline at end of file + diff --git a/data/config.kdl b/data/config.kdl index 1158276..0d1f79a 100644 --- a/data/config.kdl +++ b/data/config.kdl @@ -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 diff --git a/data/fedora.kdl b/data/fedora.kdl new file mode 100644 index 0000000..8fbb5b4 --- /dev/null +++ b/data/fedora.kdl @@ -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 +} \ No newline at end of file diff --git a/justfile b/justfile index e00a35b..9d28867 100644 --- a/justfile +++ b/justfile @@ -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 @@ -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) @@ -70,4 +72,4 @@ vendor: [private] vendor-extract: rm -rf vendor - tar pxf vendor.tar \ No newline at end of file + tar pxf vendor.tar diff --git a/system76-scheduler.spec b/system76-scheduler.spec new file mode 100644 index 0000000..c06ab2c --- /dev/null +++ b/system76-scheduler.spec @@ -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 }}} \ No newline at end of file