commit: 6d1b17cd9c95cb9076a08b04f05763c01fd10217 Author: Violet Purcell <vimproved <AT> inventati <DOT> org> AuthorDate: Mon Mar 9 23:31:04 2026 +0000 Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org> CommitDate: Tue Mar 10 21:12:04 2026 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6d1b17cd
sys-kernel/scx: add 1.1.0 Signed-off-by: Violet Purcell <vimproved <AT> inventati.org> Part-of: https://github.com/gentoo/gentoo/pull/45909 Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org> sys-kernel/scx/Manifest | 2 + .../scx/files/scx-1.1.0-scx_cake-musl-fix.patch | 104 +++++++++++++++++++ sys-kernel/scx/scx-1.1.0.ebuild | 112 +++++++++++++++++++++ 3 files changed, 218 insertions(+) diff --git a/sys-kernel/scx/Manifest b/sys-kernel/scx/Manifest index 8603936e49f3..27a299c4bff5 100644 --- a/sys-kernel/scx/Manifest +++ b/sys-kernel/scx/Manifest @@ -4,3 +4,5 @@ DIST scx-1.0.19-crates.tar.xz 51509808 BLAKE2B 7025ccded4293b54373f6487f4d001df2 DIST scx-1.0.19.tar.gz 8269630 BLAKE2B 539929aa123d3a40d70de8e1802be724e02db925a8163f74f6318113c738ffd722be878a7d7f33af1725a8efe39a2db99d787215992a699fc2755d8aaf79a34f SHA512 dd7b6e958fb7c341cca29710cc50e9ea07a9d8ee20533bab154371d069b0226f7c1899ad8f4f5ec8b970779c17dcd53143cf1fb04e4aa40229c642a554982b8f DIST scx-1.0.20-crates.tar.xz 51514256 BLAKE2B c0a771ed6e25aca5d2da074578f6edf65965bef981e58c8bb666c941d3934d480975bf94690ed2f41ed01bd3828ec8aa761e82c03c3cb9c1bd34922865f57000 SHA512 24d73d9ccdbc64912d52c17e6ad849ff0978c943b7a491f68c54d0933c8b161352f0b8a314329e32fa6d317dba14e3c1f17f76cbf39b597a5606a23728b1e6db DIST scx-1.0.20.tar.gz 8333225 BLAKE2B 94278f7afde9df29279beb9fb0381bcadb6a008d0b537c3c0a964c184f019aa7d4017c376dcc535275fbcc9a1a4b01d9753880312a6f041b7ddc1398865e6866 SHA512 d5b9af8c2c6adab02feea164bb4aa492e1cdf0501183473208c0d02528a3b4b31e6d3e67df523e7558433cc566cacecfee2f58509edb2521dee71dfe18e81952 +DIST scx-1.1.0-crates.tar.xz 59959892 BLAKE2B 8449501c813fac890308a2f16fce2e34737c2216b150decb253b593bb9c76a2fa68e04798cf4999c8dbb02cde51aa7443c53d912d3087383dd8a0e4c6ae6cb3c SHA512 4030d28f2ba59c598e1e2d6a4b1666f5c0095e9b0efba2bbe2b4a839a4060ddf89839b47433dbf2fb435a3b679415577d42769dd50ab7091cf33cfe73aa8e2c7 +DIST scx-1.1.0.tar.gz 8512325 BLAKE2B cd2a0eebf635f0b73d06ac48c7689035ad2116c5ffd44b1cb4ad94882fd000a18eb6c459e5f69e87f70c38fbb328390e66beae093fcf026e7628daba303afbd5 SHA512 74255487c16457e0ff67a4d46aa5d042c0994ecda8bc9855a443034214045b1df0cc4468b9cd2cde90c17b57f5b45a19cf77b2bb6eb92668f4a27f1e74587a88 diff --git a/sys-kernel/scx/files/scx-1.1.0-scx_cake-musl-fix.patch b/sys-kernel/scx/files/scx-1.1.0-scx_cake-musl-fix.patch new file mode 100644 index 000000000000..0b44f30261f9 --- /dev/null +++ b/sys-kernel/scx/files/scx-1.1.0-scx_cake-musl-fix.patch @@ -0,0 +1,104 @@ +From f0553197d9ccc721c1e8cc7680a0fad7b66105ca Mon Sep 17 00:00:00 2001 +From: Violet Purcell <[email protected]> +Date: Mon, 9 Mar 2026 19:09:58 -0400 +Subject: [PATCH] scx_cake: fix build on musl + +This is fixed upstream but signifcant refactoring has taken place since, +so this is a quick fix for 1.1.0. +--- a/scheds/rust/scx_cake/src/calibrate.rs ++++ b/scheds/rust/scx_cake/src/calibrate.rs +@@ -84,7 +84,22 @@ fn measure_pair(cpu_a: usize, cpu_b: usize, config: &EtdConfig) -> Option<Vec<f6 + + // Set real-time priority to minimize preemption jitter + unsafe { ++ #[cfg(target_env = "gnu")] + let param = libc::sched_param { sched_priority: 99 }; ++ #[cfg(target_env = "musl")] ++ let param = libc::sched_param { ++ sched_priority: 99, ++ sched_ss_low_priority: 0, ++ sched_ss_repl_period: libc::timespec { ++ tv_sec: 0, ++ tv_nsec: 0, ++ }, ++ sched_ss_init_budget: libc::timespec { ++ tv_sec: 0, ++ tv_nsec: 0, ++ }, ++ sched_ss_max_repl: 0, ++ }; + libc::sched_setscheduler(0, libc::SCHED_FIFO, ¶m); + } + +@@ -116,7 +131,22 @@ fn measure_pair(cpu_a: usize, cpu_b: usize, config: &EtdConfig) -> Option<Vec<f6 + + // Reset to normal priority before thread exit + unsafe { ++ #[cfg(target_env = "gnu")] + let param = libc::sched_param { sched_priority: 0 }; ++ #[cfg(target_env = "musl")] ++ let param = libc::sched_param { ++ sched_priority: 0, ++ sched_ss_low_priority: 0, ++ sched_ss_repl_period: libc::timespec { ++ tv_sec: 0, ++ tv_nsec: 0, ++ }, ++ sched_ss_init_budget: libc::timespec { ++ tv_sec: 0, ++ tv_nsec: 0, ++ }, ++ sched_ss_max_repl: 0, ++ }; + libc::sched_setscheduler(0, libc::SCHED_OTHER, ¶m); + } + }); +@@ -130,7 +160,22 @@ fn measure_pair(cpu_a: usize, cpu_b: usize, config: &EtdConfig) -> Option<Vec<f6 + + // Set real-time priority to minimize preemption jitter + unsafe { ++ #[cfg(target_env = "gnu")] + let param = libc::sched_param { sched_priority: 99 }; ++ #[cfg(target_env = "musl")] ++ let param = libc::sched_param { ++ sched_priority: 99, ++ sched_ss_low_priority: 0, ++ sched_ss_repl_period: libc::timespec { ++ tv_sec: 0, ++ tv_nsec: 0, ++ }, ++ sched_ss_init_budget: libc::timespec { ++ tv_sec: 0, ++ tv_nsec: 0, ++ }, ++ sched_ss_max_repl: 0, ++ }; + libc::sched_setscheduler(0, libc::SCHED_FIFO, ¶m); + } + +@@ -173,7 +218,22 @@ fn measure_pair(cpu_a: usize, cpu_b: usize, config: &EtdConfig) -> Option<Vec<f6 + + // Reset to normal priority before thread exit + unsafe { ++ #[cfg(target_env = "gnu")] + let param = libc::sched_param { sched_priority: 0 }; ++ #[cfg(target_env = "musl")] ++ let param = libc::sched_param { ++ sched_priority: 0, ++ sched_ss_low_priority: 0, ++ sched_ss_repl_period: libc::timespec { ++ tv_sec: 0, ++ tv_nsec: 0, ++ }, ++ sched_ss_init_budget: libc::timespec { ++ tv_sec: 0, ++ tv_nsec: 0, ++ }, ++ sched_ss_max_repl: 0, ++ }; + libc::sched_setscheduler(0, libc::SCHED_OTHER, ¶m); + } + +-- +2.53.0 + diff --git a/sys-kernel/scx/scx-1.1.0.ebuild b/sys-kernel/scx/scx-1.1.0.ebuild new file mode 100644 index 000000000000..d2c2ed4902f6 --- /dev/null +++ b/sys-kernel/scx/scx-1.1.0.ebuild @@ -0,0 +1,112 @@ +# Copyright 2024-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +LLVM_COMPAT=( {16..21} ) + +RUST_MIN_VER="1.88.0" + +inherit cargo llvm-r2 linux-info + +DESCRIPTION="sched_ext schedulers and tools" +HOMEPAGE="https://github.com/sched-ext/scx" +SRC_URI=" + https://github.com/sched-ext/scx/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz + ${CARGO_CRATE_URIS} +" +if [[ ${PKGBUMPING} != ${PVR} ]]; then + SRC_URI+=" + https://github.com/gentoo-crate-dist/scx/releases/download/v${PV}/scx-${PV}-crates.tar.xz + " +fi + +LICENSE="GPL-2" +# Dependent crate licenses +LICENSE+=" + Apache-2.0 BSD-2 BSD CC0-1.0 ISC MIT MPL-2.0 Unicode-3.0 ZLIB +" +SLOT="0" +KEYWORDS="~amd64" + +DEPEND=" + >=dev-libs/libbpf-1.6:= + sys-libs/libseccomp + virtual/libelf:= + virtual/zlib:= +" +RDEPEND=" + ${DEPEND} +" +BDEPEND=" + app-misc/jq + dev-libs/protobuf[protoc(+)] + >=dev-util/bpftool-7.5.0 + $(llvm_gen_dep ' + llvm-core/clang:${LLVM_SLOT}=[llvm_targets_BPF(-)] + ') +" +PDEPEND="~sys-kernel/scx-loader-${PV}" + +CONFIG_CHECK=" + ~BPF + ~BPF_EVENTS + ~BPF_JIT + ~BPF_JIT_ALWAYS_ON + ~BPF_JIT_DEFAULT_ON + ~BPF_SYSCALL + ~DEBUG_INFO_BTF + ~FTRACE + ~SCHED_CLASS_EXT +" + +QA_PREBUILT="/usr/bin/vmlinux_docify" + +PATCHES=( + # Made obsolete by rebasing upstream, can be dropped in 1.1.1 + "${FILESDIR}/${P}-scx_cake-musl-fix.patch" +) + +pkg_setup() { + linux-info_pkg_setup + llvm-r2_pkg_setup + rust_pkg_setup +} + +src_compile() { + local -x BPF_CLANG=clang-${LLVM_SLOT} + cargo_src_compile +} + +src_test() { + # Skip broken tests in scx_mitosis and scx_utils + # Upstream: https://github.com/sched-ext/scx/issues/3418 + cargo_src_test -- \ + --skip cell_manager::tests::test_borrowable_cpumasks_respects_cpuset \ + --skip cell_manager::tests::test_cpuset_parsing_from_file \ + --skip cell_manager::tests::test_deficit_all_cells_exceed_target \ + --skip cell_manager::tests::test_symmetric_pairwise_overlap_produces_equal_cells \ + --skip cpumask::tests::test_to_cpulist_roundtrip +} + +src_install() { + einfo "Installing schedulers" + local sched + for sched in scheds/rust/scx_*; do + einfo "Installing ${sched#scheds/rust/}" + dobin "target/$(usex debug debug release)/${sched#scheds/rust}" + done + + einfo "Installing tools" + dobin target/$(usex debug debug release)/{scx{cash,top},vmlinux_docify} + + dodoc README.md + + local readme readme_name + for readme in scheds/rust/*/README.md ./rust/*/README.md; do + [[ -e ${readme} ]] || continue + readme_name="${readme#*/rust/}" + readme_name="${readme_name%/README.md}" + newdoc "${readme}" "${readme_name}.md" + done +}
