Re: [PATCH v3] sched_ext: Use WRITE_ONCE() for the write side of scx_enable helper pointer

From: zhidao su

Date: Mon Mar 09 2026 - 00:35:10 EST


Tested v3 on a KCSAN-enabled kernel (CONFIG_KCSAN=y, non-strict mode)
built from this tree and booted via virtme-ng:

Kernel: 7.0.0-rc2
CPUs: 4 (QEMU/KVM)
Memory: 4G

All 28 sched_ext selftests pass:

PASSED: 28
SKIPPED: 0
FAILED: 0

No KCSAN reports related to the scx_enable helper pointer were
observed during the test run.

The fix (staging kthread_run_worker() result in a local variable and
only calling WRITE_ONCE(helper, w) after confirming validity) correctly
closes the window where a concurrent lockless reader could observe an
ERR pointer via READ_ONCE(helper).

zhidao su