Re: [Patch v4 12/16] sched/cache: Fix race condition during sched domain rebuild
From: Peter Zijlstra
Date: Mon May 18 2026 - 10:50:36 EST
On Wed, May 13, 2026 at 01:39:23PM -0700, Tim Chen wrote:
> /*
> * Enable/disable cache aware scheduling according to
> * user input and the presence of hardware support.
> + * Expected to be protected by cpus_read_lock() and
> + * sched_domains_mutex_lock()
> */
> -static void sched_cache_active_set(bool locked)
> +static void _sched_cache_active_set(void)
Like so?
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -920,11 +920,12 @@ static bool alloc_sd_llc(const struct cp
/*
* Enable/disable cache aware scheduling according to
* user input and the presence of hardware support.
- * Expected to be protected by cpus_read_lock() and
- * sched_domains_mutex_lock()
*/
static void _sched_cache_active_set(void)
{
+ lockdep_assert_cpus_held();
+ lockdep_assert_held(&sched_domains_mutex);
+
/* hardware does not support */
if (!static_branch_likely(&sched_cache_present)) {
static_branch_disable_cpuslocked(&sched_cache_active);