Re: [PATCH 4/4] sched_ext: scx_qmap: replace FIFO queue maps with arena-backed lists
From: Andrea Righi
Date: Thu Apr 16 2026 - 06:02:06 EST
Hi Tejun,
On Wed, Apr 15, 2026 at 10:16:26PM -1000, Tejun Heo wrote:
> Arena simplifies verification and allows more natural programming.
> Convert scx_qmap to arena as preparation for further sub-sched work.
>
> Replace the five BPF_MAP_TYPE_QUEUE maps with doubly-linked lists in
> arena, threaded through task_ctx. Each queue is a struct qmap_fifo with
> head/tail pointers and its own per-queue bpf_res_spin_lock.
We should probably update the description at the beginning of the files as well,
mentioning the arena-backed lists.
>
> qmap_dequeue() now properly removes tasks from the queue instead of
> leaving stale entries for dispatch to skip.
>
> Signed-off-by: Tejun Heo <tj@xxxxxxxxxx>
> ---
...
> @@ -756,6 +808,8 @@ void BPF_STRUCT_OPS(qmap_dump_task, struct scx_dump_ctx *dctx, struct task_struc
>
> QMAP_TOUCH_ARENA();
>
> + QMAP_TOUCH_ARENA();
> +
Copy/paste noise?
> if (suppress_dump)
> return;
> v = bpf_task_storage_get(&task_ctx_stor, p, NULL, 0);
> @@ -1018,6 +1072,9 @@ s32 BPF_STRUCT_OPS_SLEEPABLE(qmap_init)
> }
> qa.task_ctxs = slab;
>
> + bpf_for(i, 0, 5)
> + qa.fifos[i].idx = i;
> +
> bpf_for(i, 0, max_tasks)
> slab[i].next_free = (i + 1 < max_tasks) ? &slab[i + 1] : NULL;
> qa.task_free_head = &slab[0];
Thanks,
-Andrea