Re: [PATCH 2/2] selftests/sched_ext: add cpuset DL rollback test
From: Cheng-Yang Chou
Date: Fri Apr 17 2026 - 12:25:28 EST
Hi Guopeng,
On Fri, Apr 17, 2026 at 11:37:42AM +0800, Guopeng Zhang wrote:
[...]
> +
> +#ifndef SYS_sched_setattr
> +#if defined(__x86_64__)
> +#define SYS_sched_setattr 314
> +#elif defined(__i386__)
> +#define SYS_sched_setattr 351
> +#elif defined(__aarch64__)
Nit: Since RISC-V uses the same assigned syscall number as ARM64, it
would be nice to support it here as well,
+#elif defined(__aarch64__) || defined(__riscv)
> +#define SYS_sched_setattr 274
> +#else
> +#error "Unknown architecture: please define SYS_sched_setattr"
> +#endif
> +#endif
[...]
> +static enum scx_test_status run(void *arg)
> +{
> + struct cpuset_dl_rollback_ctx *ctx = arg;
> + char procs_path[PATH_MAX];
> + long long before_bw, after_bw;
> + int ret;
> +
> + ret = read_cpu_total_bw(ctx->target_cpu, &before_bw);
> + SCX_FAIL_IF(ret, "Failed to read baseline total_bw (%d)", ret);
The first read_cpu_total_bw() call is redundant because before_bw is
overwritten after spawn_dl_child(). Use a separate variable for the
baseline if needed. Otherwise, the second call already handles the same
error check.
> +
> + ctx->link = bpf_map__attach_struct_ops(ctx->skel->maps.cpuset_dl_rollback_ops);
> + SCX_FAIL_IF(!ctx->link, "Failed to attach scheduler");
> +
> + ret = spawn_dl_child(ctx);
> + switch (ret) {
> + case -EACCES:
> + case -EPERM:
> + fprintf(stderr,
> + "Skipping test: unable to place child in the source cgroup or enable SCHED_DEADLINE due to permissions (%d)\n",
> + ret);
> + return SCX_TEST_SKIP;
> + case -EBUSY:
> + fprintf(stderr,
> + "Skipping test: SCHED_DEADLINE admission control rejected the child (%d)\n",
> + ret);
> + return SCX_TEST_SKIP;
> + case -EINVAL:
> + fprintf(stderr,
> + "Skipping test: unable to enable SCHED_DEADLINE for the child in this environment (%d)\n",
> + ret);
> + return SCX_TEST_SKIP;
> + }
> + SCX_FAIL_IF(ret, "Failed to start SCHED_DEADLINE child (%d)", ret);
> +
> + ret = read_cpu_total_bw(ctx->target_cpu, &before_bw);
Overwritten here.
> + SCX_FAIL_IF(ret, "Failed to read pre-move total_bw (%d)", ret);
--
Thanks,
Cheng-Yang