Re: [PATCH] sched/numa: Prevent race on sysctl_numa_balancing static key

K Prateek Nayak <[email protected]>
Newsgroups org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Hell Chen,

On 8/3/2026 6:00 PM, Chen Jinghuang wrote:
> +static DEFINE_MUTEX(numabalancing_mutex);
> +
>  void set_numabalancing_state(bool enabled)
>  {
> +	mutex_lock(&numabalancing_mutex);
>  	if (enabled)
>  		sysctl_numa_balancing_mode = NUMA_BALANCING_NORMAL;
>  	else
>  		sysctl_numa_balancing_mode = NUMA_BALANCING_DISABLED;
>  	__set_numabalancing_state(enabled);
> +	mutex_unlock(&numabalancing_mutex);
>  }

Doesn't sysctl_numa_balancing() directly call __set_numabalancing_state()
and this bit is only used by check_numabalancing_enable() on the mm side
during early init?

I think you should move this serialization into sysctl_numa_balancing()
because nothing can race during early init and we only need this for sysfs
writes.

-- 
Thanks and Regards,
Prateek
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.