All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHSET sched_ext/for-7.4-fixes] sched_ext: Enforce SCX_CAP_BASE in core-sched task selection
@ 2026-11-26 21:33 Kuba Piecuch
  2026-11-26 21:33 ` [PATCH 1/2] " Kuba Piecuch
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Kuba Piecuch @ 2026-11-26 21:33 UTC (permalink / raw)
  To: Tejun Heo, David Vernet, Andrea Righi, Changwoo Min
  Cc: Kuba Piecuch, sched-ext, linux-kernel

Under CONFIG_EXT_SUB_SCHED, sched_ext enforces SCX_CAP_BASE on the
dispatch path via scx_task_can_stay_on_cpu() and scx_rescuee(). However,
ext_sched_class leaves .task_is_throttled unset. Under CONFIG_SCHED_CORE,
sched_core_find() and try_steal_cookie() select tasks directly from
rq->core_tree and rely on sched_task_is_throttled() to filter ineligible
tasks before bypassing pick_task_scx(). As a result, a sub-scheduler task
sharing a core-scheduling cookie with an SMT sibling can be picked or
stolen onto a CPU where its sub-scheduler lacks SCX_CAP_BASE.

Patch 1 implements task_is_throttled_scx() under CONFIG_SCHED_CORE and
wires it to ext_sched_class.task_is_throttled.

Patch 2 adds the sub_core_caps selftest exercising a cid-form root
scheduler and child sub-scheduler on an SMT pair, verifying that a
cookie-matching sub-scheduler task is not picked on a denied sibling and
runs once SCX_CAP_BASE is granted. It requires CONFIG_SCHED_CORE=y (not
enabled by default in tools/testing/selftests/sched_ext/config) and an
SMT pair plus a third CPU. Without patch 1, the selftest fails with:

  ERR: sub_core_caps.c:534
  Sub task ran on denied CPU 1 via core-sched (run=6 deq_cse=6)

The patches were written with the help of an AI coding assistant. I have
reviewed the patches and verified the tests run by the tool.

Kuba Piecuch (2):
  sched_ext: Enforce SCX_CAP_BASE in core-sched task selection
  selftests/sched_ext: Add sub_core_caps test for core-sched
    SCX_CAP_BASE

 kernel/sched/ext/ext.c                        |  11 +
 tools/testing/selftests/sched_ext/Makefile    |   1 +
 .../selftests/sched_ext/sub_core_caps.c       | 616 ++++++++++++++++++
 .../sched_ext/sub_core_caps_root.bpf.c        |  78 +++
 .../sched_ext/sub_core_caps_sub.bpf.c         |  84 +++
 5 files changed, 790 insertions(+)
 create mode 100644 tools/testing/selftests/sched_ext/sub_core_caps.c
 create mode 100644 tools/testing/selftests/sched_ext/sub_core_caps_root.bpf.c
 create mode 100644 tools/testing/selftests/sched_ext/sub_core_caps_sub.bpf.c


base-commit: 0919f8bea37e7e354b342c2dff52dd8f5b958d6a
-- 
2.56.1.839.g22a8290db9-goog


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-27 21:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 21:33 [PATCHSET sched_ext/for-7.4-fixes] sched_ext: Enforce SCX_CAP_BASE in core-sched task selection Kuba Piecuch
2026-11-26 21:33 ` [PATCH 1/2] " Kuba Piecuch
2026-11-26 21:33 ` [PATCH 2/2] selftests/sched_ext: Add sub_core_caps test for core-sched SCX_CAP_BASE Kuba Piecuch
2026-11-27 21:17 ` [PATCHSET sched_ext/for-7.4-fixes] sched_ext: Enforce SCX_CAP_BASE in core-sched task selection Tejun Heo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.