scx.full: init; scx.rusty: init (#352077)

This commit is contained in:
Masum Reza
2024-10-30 08:48:09 +05:30
committed by GitHub
11 changed files with 1783 additions and 20 deletions
+6 -1
View File
@@ -10,6 +10,9 @@
}:
let
versionInfo = lib.importJSON ./version.json;
# Useful function for packaging schedulers, should be used unless the build system is too complex
# passes some default values like src, version (all of which can be overridden)
mkScxScheduler =
packageType:
args@{ schedulerName, ... }:
@@ -43,7 +46,7 @@ let
"zerocallusedregs"
] ++ (args.hardeningDisable or [ ]);
meta = args.meta // {
meta = (args.meta or { }) // {
description = args.meta.description or "";
longDescription =
(args.meta.longDescription or "")
@@ -65,7 +68,9 @@ let
{ layered = import ./scx_layered; }
{ rlfifo = import ./scx_rlfifo; }
{ rustland = import ./scx_rustland; }
{ rusty = import ./scx_rusty; }
{ csheds = import ./scx_csheds.nix; }
{ full = import ./scx_full.nix; }
];
in
(lib.mapAttrs (name: scheduler: callPackage scheduler { inherit mkScxScheduler; }) schedulers)
@@ -4,7 +4,7 @@
mkScxScheduler,
}:
mkScxScheduler "rust" rec {
mkScxScheduler "rust" {
schedulerName = "scx_bpfland";
cargoRoot = "scheds/rust/scx_bpfland";
+7 -4
View File
@@ -53,7 +53,7 @@ let
});
in
mkScxScheduler "c" rec {
mkScxScheduler "c" {
schedulerName = "scx_csheds";
postPatch = ''
@@ -78,8 +78,11 @@ mkScxScheduler "c" rec {
mesonFlags = [
(lib.mapAttrsToList lib.mesonEnable {
# systemd unit is implemented in the nixos module
# upstream systemd files are a hassle to patch
"systemd" = false;
"openrc" = false;
# libbpf is already fetched as FOD
"libbpf_a" = false;
# not for nix
"libalpm" = false;
@@ -87,7 +90,7 @@ mkScxScheduler "c" rec {
(lib.mapAttrsToList lib.mesonBool {
# needed libs are already fetched as FOD
"offline" = true;
# rust schedulers are built seperately
# rust based schedulers are built seperately
"enable_rust" = false;
})
];
@@ -99,8 +102,8 @@ mkScxScheduler "c" rec {
meta = {
description = "Sched-ext C userspace schedulers";
longDescription = ''
This includes C based schedulers such as scx_central,
scx_flatcg, scx_pair, scx_qmap, scx_simple, scx_userland.
This includes C based schedulers such as scx_central, scx_flatcg,
scx_nest, scx_pair, scx_qmap, scx_simple, scx_userland.
'';
};
}
+28
View File
@@ -0,0 +1,28 @@
{
stdenv,
lib,
scx,
mkScxScheduler,
}:
scx.csheds.overrideAttrs (oldAttrs: {
pname = "scx_full";
postInstall =
(oldAttrs.postInstall or "")
+ ''
cp ${lib.getExe scx.bpfland} $out/bin/
cp ${lib.getExe scx.lavd} $out/bin/
cp ${lib.getExe scx.layered} $out/bin/
cp ${lib.getExe scx.rlfifo} $out/bin/
cp ${lib.getExe scx.rustland} $out/bin/
cp ${lib.getExe scx.rusty} $out/bin/
'';
meta = oldAttrs.meta // {
description = "Sched-ext C and Rust userspace schedulers";
longDescription = ''
This includes C based schedulers such as scx_central, scx_flatcg,
scx_pair, scx_qmap, scx_simple, scx_userland and Rust based schedulers
like scx_rustland, scx_bpfland, scx_lavd, scx_layered, scx_rlfifo.
'';
};
})
@@ -4,7 +4,7 @@
mkScxScheduler,
}:
mkScxScheduler "rust" rec {
mkScxScheduler "rust" {
schedulerName = "scx_lavd";
cargoRoot = "scheds/rust/scx_lavd";
@@ -4,7 +4,7 @@
mkScxScheduler,
}:
mkScxScheduler "rust" rec {
mkScxScheduler "rust" {
schedulerName = "scx_layered";
cargoRoot = "scheds/rust/scx_layered";
@@ -4,7 +4,7 @@
mkScxScheduler,
}:
mkScxScheduler "rust" rec {
mkScxScheduler "rust" {
schedulerName = "scx_rlfifo";
cargoRoot = "scheds/rust/scx_rlfifo";
@@ -28,8 +28,9 @@ mkScxScheduler "rust" rec {
meta = {
description = "Sched-ext Rust userspace scheduler";
longDescription = ''
scx_rlfifo is a simple FIFO scheduler runs in user-space, based on
the scx_rustland_core framework. Not a production ready scheduler.
scx_rlfifo is a simple FIFO scheduler runs in user-space, based on the
scx_rustland_core framework. Not for production use, but useful to test as a
baseline against complex scheduling polices or for a basic FIFO scheduling approach.
'';
mainProgram = "scx_rlfifo";
};
@@ -4,7 +4,7 @@
mkScxScheduler,
}:
mkScxScheduler "rust" rec {
mkScxScheduler "rust" {
schedulerName = "scx_rustland";
cargoRoot = "scheds/rust/scx_rustland";
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,38 @@
{
stdenv,
lib,
mkScxScheduler,
}:
mkScxScheduler "rust" {
schedulerName = "scx_rusty";
cargoRoot = "scheds/rust/scx_rusty";
cargoLock.lockFile = ./Cargo.lock;
postPatch = ''
rm Cargo.toml Cargo.lock
ln -fs ${./Cargo.lock} scheds/rust/scx_rusty/Cargo.lock
'';
preBuild = ''
cd scheds/rust/scx_rusty
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp target/${stdenv.targetPlatform.config}/release/scx_rusty $out/bin/
runHook postInstall
'';
meta = {
description = "Sched-ext Rust userspace scheduler";
longDescription = ''
Multi-domain, BPF/userspace hybrid scheduler. BPF portion of the scheduler does
a simple round robin in each domain, and the userspace portion calculates the load
factor of each domain, and informs BPF of how tasks should be load balanced accordingly.
Rusty is designed to be flexible, accommodating different architectures and workloads.
'';
mainProgram = "scx_rusty";
};
}
+7 -8
View File
@@ -4,10 +4,10 @@
set -euo pipefail
srcJson="$(realpath "./pkgs/os-specific/linux/scx/version.json")"
srcFolder="$(dirname "$srcJson")"
versionJson="$(realpath "./pkgs/os-specific/linux/scx/version.json")"
nixFolder="$(dirname "$versionJson")"
localVer=$(jq -r .version <$srcJson)
localVer=$(jq -r .version <$versionJson)
latestVer=$(curl -s https://api.github.com/repos/sched-ext/scx/releases/latest | jq -r .tag_name | sed 's/v//g')
if [ "$localVer" == "$latestVer" ]; then
@@ -36,16 +36,15 @@ jq \
".scx.version = \$latestVer | .scx.hash = \$latestHash |\
.bpftool.rev = \$bpftoolRev | .bpftool.hash = \$bpftoolHash |\
.libbpf.rev = \$libbpfRev | .libbpf.hash = \$libbpfHash" \
"$srcJson" | sponge $srcJson
"$versionJson" | sponge $versionJson
rm -f Cargo.toml Cargo.lock
pushd scheds/rust
for scheduler in bpfland lavd layered rlfifo rustland; do
pushd "scx_$scheduler"
for scheduler in bpfland lavd layered rlfifo rustland rusty; do
pushd "scheds/rust/scx_$scheduler"
cargo generate-lockfile
cp Cargo.lock "$srcFolder/scx_$scheduler/Cargo.lock"
cp Cargo.lock "$nixFolder/scx_$scheduler/Cargo.lock"
popd
done