]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
sched_ext: Add cmask mask ops
authorTejun Heo <tj@kernel.org>
Tue, 19 May 2026 07:53:11 +0000 (21:53 -1000)
committerTejun Heo <tj@kernel.org>
Thu, 21 May 2026 07:14:46 +0000 (21:14 -1000)
commitf31e89a8f583cb8b1b68002cedb77ce444d6f7d2
tree6fd83d24aa5bb9314f0a254b583b5c19f6401bee
parenta0b48fd7fe2854211eadb5056e72bce3946140c1
sched_ext: Add cmask mask ops

Sub-sched cap code and other upcoming consumers need bulk cmask ops, both
mutating (and/or/copy/andnot) and predicate (subset/intersects/empty).

cmask_walk_op2() walks the intersection of two ranges word by word;
cmask_walk_op1() walks one range. Both are __always_inline and dispatched on
a compile-time-constant op enum, so each public entry collapses to a
specialized loop with the inner switch reduced to one arm.

Two-cmask ops only touch bits in the intersection of the two ranges; bits
outside are left unchanged. scx_cmask_or_racy() and scx_cmask_copy_racy()
mirror the locking forms but read @src word-by-word through data_race();
callers handle ordering with concurrent writers themselves.

v2: Add scx_cmask_empty().

Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
kernel/sched/ext_cid.c
kernel/sched/ext_cid.h