diff options
| author | Chen Yu <yu.c.chen@intel.com> | 2026-05-13 13:39:23 -0700 |
|---|---|---|
| committer | Peter Zijlstra <peterz@infradead.org> | 2026-05-18 21:33:17 +0200 |
| commit | 9f7c745850b4b1b7e4706ae81f04c43f204a6a8d (patch) | |
| tree | 49539162d3f7756f55c77cae12956c2d43c66ead /scripts/git.orderFile | |
| parent | d6b9afab44e23d537fb85ecf50330baaf9ec82e9 (diff) | |
sched/cache: Fix race condition during sched domain rebuild
sched_cache_active_set_unlocked() checks hardware support without
locks:
static void sched_cache_active_set(bool locked)
{
/* hardware does not support */
if (!static_branch_likely(&sched_cache_present)) {
_sched_cache_active_set(false, locked);
return;
}
...
If build_sched_domains() runs concurrently during CPU hotplug,
it can disable sched_cache_present under sched_domains_mutex
and the CPU hotplug lock. If a debugfs write thread evaluates
sched_cache_present as true right before that, and then blocks
or gets preempted, it might proceed to enable sched_cache_active
after the hardware support has been marked as absent. Make it
safer by acquiring cpus_read_lock() and sched_domains_mutex_lock()
when the user changes sched_cache_active via debugfs.
This bug was reported by sashiko.
Fixes: 067a31358143 ("sched/cache: Allow the user space to turn on and off cache aware scheduling")
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
Co-developed-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/9afddf439687f04bb56b46625bd9f153eb8abad5.1778703694.git.tim.c.chen@linux.intel.com
Diffstat (limited to 'scripts/git.orderFile')
0 files changed, 0 insertions, 0 deletions
