Re: [PATCH v3 sched_ext/for-7.2] sched_ext: add p->scx.tid and SCX_OPS_TID_TO_TASK lookup
From: Andrea Righi
Date: Sun Apr 19 2026 - 15:02:22 EST
On Sun, Apr 19, 2026 at 08:36:45AM -1000, Tejun Heo wrote:
...
> +static void scx_tid_hash_insert(struct task_struct *p)
> +{
> + int ret;
> +
> + lockdep_assert_held(&scx_tasks_lock);
> +
> + ret = rhashtable_lookup_insert_fast(&scx_tid_hash,
> + &p->scx.tid_hash_node,
> + scx_tid_hash_params);
> + WARN_ON_ONCE(ret);
> +}
Hm... WARN_ON_ONCE() only fires once, it can be hard to catch subsequent errors,
especially in case of -ENOMEM.
How about triggering WARN_ON_ONCE(ret == -EEXIST), which should be considered a
real sched_ext core bug, and use scx_error() for insert failures (ENOMEM).
In this way the error is more obvious for the BPF scheduler and can immediately
exit if it happens (even if scx_error() is probably a bit of a semantic stretch
in this case)?
Thanks,
-Andrea