[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aCItuWh-BLp3jC6h@slm.duckdns.org>
Date: Mon, 12 May 2025 07:19:53 -1000
From: Tejun Heo <tj@...nel.org>
To: Andrea Righi <arighi@...dia.com>
Cc: David Vernet <void@...ifault.com>, Changwoo Min <changwoo@...lia.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] sched_ext/idle: Make scx_bpf_select_cpu_and() usable
from any context
Hello,
On Mon, May 12, 2025 at 05:14:56PM +0200, Andrea Righi wrote:
> #ifdef CONFIG_SMP
> + /*
> + * If called from an unlocked context, try to acquire
> + * cpus_read_lock() to avoid races with CPU hotplug.
> + */
> + if (scx_kf_allowed_if_unlocked())
> + if (!cpus_read_trylock())
> + return -EBUSY;
Is this meaningful? The idle CPU selection is already racy against CPU
hotplugs and we depend on the scheduler core to fix it up afterwards. Even
if scx_bpf_select_cpu_and() is not racy, it will drop the cpus lock before
returning and becomes racy again right there. ie. This doesn't add any
meaningful protection.
Thanks.
--
tejun
Powered by blists - more mailing lists