Re: [PATCH 1/2] sched_ext: Add an event, SCX_EV_ENQ_SLICE_DFL

From: Changwoo Min
Date: Fri Feb 07 2025 - 01:28:26 EST


Hi Andrea,

On 25. 2. 7. 15:17, Andrea Righi wrote:
Hi Changwoo,

On Fri, Feb 07, 2025 at 12:13:37PM +0900, Changwoo Min wrote:
Add a core event, SCX_EV_ENQ_SLICE_DFL, which represents how many
tasks have been enqueued (or pick_task-ed) with a default time slice
(SCX_SLICE_DFL).

Scheduling a task with SCX_SLICE_DFL unintentionally would be a source
of latency spikes because SCX_SLICE_DFL is relatively long (20 msec).
Thus, soaring the SCX_EV_ENQ_SLICE_DFL value would be a sign of BPF
scheduler bugs, causing latency spikes.

__scx_add_event() is used since the caller holds an rq lock,
so the preemption has already been disabled.

We may want to consider select_task_rq_scx() as well, when ops.select_cpu()
is not implemented (or during rq_bypass).

In this case, if scx_select_cpu_dfl() finds an idle CPU, we implicitly
dispatch the task to the local DSQ with SCX_SLICE_DFL.

You are right. I will add it too.

Thanks!
-- Changwoo