Skip to content

sched_ext: Update demo schedulers and selftests for deprecated APIs

Cheng-Yang Chou lkml sched-ext 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 posting 2/20 of 2 patches 1 replyIn review
  2. v5 Latest2 patches 1 replyIn review
  3. v4 posting 1/22 patches 1 replySuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v32 patches2 repliesSuperseded
v22 patches3 repliesSuperseded
v12 patches2 repliesSuperseded

Changes in v5 from the cover letter

- Fix trailing blank line in select_cpu_vtime_stopping() (Tejun Heo)
- Fix prev_state type: unsigned long -> unsigned int in maximal_sched_switch (Tejun Heo)
- Link to v4:
https://lore.kernel.org/all/[email protected]/

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2sched_ext: Update demo schedulers and selftests to use scx_bpf_task_set_dsq_vtime()tools/sched_ext/scx_flatcg.bpf.c tools/sched_ext/scx_simple.bpf.c tools/testing/selftests/sched_ext/select_cpu_vtime.bpf.c+15 -90 replies
2/2sched_ext: Update selftests to drop ops.cpu_acquire/release()tools/testing/selftests/sched_ext/maximal.bpf.c tools/testing/selftests/sched_ext/maximal.c tools/testing/selftests/sched_ext/reload_loop.c+12 -90 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchAndrea Righi
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH v5 0/2] sched_ext: Update demo schedulers and selftests for deprecated APIs

Two sets of sched_ext APIs have been deprecated:

- Direct writes to p->scx.dsq_vtime in favor of scx_bpf_task_set_dsq_vtime()
- ops.cpu_acquire/release() in favor of handling CPU preemption via the sched_switch tracepoint, as introduced by commit a3f5d4822253 ("sched_ext: Allow scx_bpf_reenqueue_local() to be called from anywhere")

This series updates the demo schedulers (scx_simple, scx_flatcg) and selftests (select_cpu_vtime, maximal) to use the new APIs, keeping them in sync with current best practices.

Patch 1 updates scx_simple, scx_flatcg, and select_cpu_vtime to use scx_bpf_task_set_dsq_vtime() with scale_by_task_weight_inverse(), with the delta computation moved inside the if block.

Patch 2 replaces the cpu_acquire/release stubs in the maximal selftest with a minimal sched_switch TP program, and fixes the maximal and reload_loop tests to properly attach the sched_switch tracepoint via bpf_map__set_autoattach() and maximal__attach(), as both tests use the maximal skeleton.

Changes in v5:
- Fix trailing blank line in select_cpu_vtime_stopping() (Tejun Heo)
- Fix prev_state type: unsigned long -> unsigned int in maximal_sched_switch (Tejun Heo)
- Link to v4:
https://lore.kernel.org/all/[email protected]/

Changes in v4:
- Drop scx_qmap changes from patch 2, already applied in commit 3229ac4a5ef5 ("sched_ext: Add SCX_OPS_ALWAYS_ENQ_IMMED ops flag")
- Move delta computation inside the if block (Tejun)
- Link to v3:
https://lore.kernel.org/all/[email protected]/

Changes in v3:
- Use scale_by_task_weight_inverse() instead of scale_by_task_weight() (Andrea Righi)
- Link to v2:
https://lore.kernel.org/all/[email protected]/

Changes in v2:
- Use scx_bpf_task_set_dsq_vtime() with scale_by_task_weight instead of direct assignment and remove redundant bpf_ksym_exists() logic (Andrea Righi)
- Mention commit a3f5d4822253 ("sched_ext: Allow scx_bpf_reenqueue_local() to be called from anywhere") in the commit message to clarify why ops.cpu_acquire/release() are being deprecated (Andrea Righi)
- Fix maximal.c and reload_loop.c to actually attach the sched_switch tracepoint by calling bpf_map__set_autoattach() and maximal__attach() (Andrea Righi)
- Link to v1:
https://lore.kernel.org/all/[email protected]/

Thanks,
Cheng-Yang

---

Cheng-Yang Chou (2):
sched_ext: Update demo schedulers and selftests to use
scx_bpf_task_set_dsq_vtime()
sched_ext: Update selftests to drop ops.cpu_acquire/release()

 tools/sched_ext/scx_flatcg.bpf.c                  | 12 +++++++-----
 tools/sched_ext/scx_simple.bpf.c                  |  6 ++++--
 tools/testing/selftests/sched_ext/maximal.bpf.c   | 15 ++++++---------
 tools/testing/selftests/sched_ext/maximal.c       |  3 +++
 tools/testing/selftests/sched_ext/reload_loop.c   |  3 +++
 .../selftests/sched_ext/select_cpu_vtime.bpf.c    |  6 ++++--
 6 files changed, 27 insertions(+), 18 deletions(-)
Signature · 1 line
2.48.1