Skip to content

sched_ext: lockless peek operation for DSQs

Ryan Newton lkml sched-ext 5 versions – Applied

Status from this message: Applied to sched_ext/for-6.19.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest2 patches 1 replyApplied
  2. v42 patches 4 repliesSuperseded
  3. v32 patches 7 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v23 patches1 replySuperseded
v13 patches2 repliesSuperseded

Changes in v5 from the cover letter

- minor comment tweak requested in review
- add Reviewed-bys [email protected]

Patches in v5 Applied

#Subject and filesSizeRepliesApplied
1/2sched_ext: Add lockless peek operation for DSQsinclude/linux/sched/ext.h kernel/sched/ext.c tools/sched_ext/include/scx/common.bpf.h +1 more+76 -20 replies
2/2sched_ext: Add a selftest for scx_bpf_dsq_peektools/testing/selftests/sched_ext/Makefile tools/testing/selftests/sched_ext/peek_dsq.bpf.c tools/testing/selftests/sched_ext/peek_dsq.c+476 -00 replies

Reviews trailers per patch

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

PatchAndrea RighiChristian Loehle
1/2R-b R-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: lockless peek operation for DSQs

This allows sched_ext schedulers an inexpensive operation to peek at the first element in a queue (DSQ), without creating an iterator and acquiring the lock on that queue.

Note that manual testing has thus far included a modified version of the example qmap scheduler that exercises peek, as well as a modified modified LAVD (from the SCX repo) that exercises peek. The attached test passes >1000 stress tests when run in concurrent VMs, and when run sequentially on the host kernel. Presently, tested on the below workstation and server processors.
- AMD Ryzen Threadripper PRO 7975WX 32-Cores
- AMD EPYC 9D64 88-Core Processor

Initial experiments indicate a substantial speedup (on schbench) when running an SCX scheduler with per-cpu DSQs and peeking each queue to retrieve the task with the minimum vruntime across all the CPUs.

---
Changes in v5:
- minor comment tweak requested in review
- add Reviewed-bys [email protected]

Changes in v4:
- review comments (from [email protected]) addressed, add Reviewed-by
- make the test much lighter weight with 4 rather than 100 workers
- link: https://lore.kernel.org/lkml/[email protected]/

Changes in v3:
- inline helpers and simplify
- coding style tweaks
- link: https://lore.kernel.org/lkml/[email protected]/

Changes in v2:
- make peek() only work for user DSQs and error otherwise
- added a stress test component to the selftest that performs many peeks
- responded to review comments from [email protected] and [email protected]
- link: https://lore.kernel.org/lkml/[email protected]/

v1 link: https://lore.kernel.org/lkml/[email protected]/

Ryan Newton (2):
sched_ext: Add lockless peek operation for DSQs
sched_ext: Add a selftest for scx_bpf_dsq_peek

 include/linux/sched/ext.h                     |   1 +
 kernel/sched/ext.c                            |  58 +++-
 tools/sched_ext/include/scx/common.bpf.h      |   1 +
 tools/sched_ext/include/scx/compat.bpf.h      |  18 ++
 tools/testing/selftests/sched_ext/Makefile    |   1 +
 .../selftests/sched_ext/peek_dsq.bpf.c        | 251 ++++++++++++++++++
 tools/testing/selftests/sched_ext/peek_dsq.c  | 224 ++++++++++++++++
 7 files changed, 552 insertions(+), 2 deletions(-)
 create mode 100644 tools/testing/selftests/sched_ext/peek_dsq.bpf.c
 create mode 100644 tools/testing/selftests/sched_ext/peek_dsq.c
Signature · 1 line
2.51.0