process-util: Add support SCHED_EXT scheduling policy

Allow CPUSchedulingPolicy to be set to "ext". SCHED_EXT is a new
scheduling policy in Linux v6.12 that allows processes to be scheduled
using custom BPF schedulers instead of the default in-kernel ones.

Selectively setting the SCHED_EXT policy is useful for systems running
in "partial mode" where not all processes are run using a custom
scheduler.

Fallback to SCHED_OTHER and print an error message for systems where
SCHED_EXT isn't available.
This commit is contained in:
Matt Fleming
2025-10-23 10:13:49 +01:00
committed by Mike Yuan
parent 84dcbc3fd2
commit 4dcbfbb1ad
9 changed files with 69 additions and 10 deletions

View File

@@ -55,3 +55,11 @@ int __clone2(int (*fn)(void *), void *stack_base, size_t stack_size, int flags,
int missing_sched_setattr(pid_t pid, struct sched_attr *attr, unsigned flags);
# define sched_setattr missing_sched_setattr
#endif
/* f0e1a0643a59bf1f922fa209cec86a170b784f3f (6.12),
* defined in sched.h in glibc since glibc-2.41. */
#ifndef SCHED_EXT
# define SCHED_EXT 7
#else
static_assert(SCHED_EXT == 7, "");
#endif