[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aFyBGAce73hzbPhQ@slm.duckdns.org>
Date: Wed, 25 Jun 2025 13:07:04 -1000
From: Tejun Heo <tj@...nel.org>
To: Henry Huang <henry.hj@...group.com>
Cc: arighi@...dia.com, changwoo@...lia.com,
谈鉴锋 <henry.tjf@...group.com>,
linux-kernel@...r.kernel.org, sched-ext@...ts.linux.dev,
void@...ifault.com, "Yan Yan(cailing)" <yanyan.yan@...group.com>
Subject: Re: [PATCH v3] sched_ext: include SCX_OPS_TRACK_MIGRATION
Hello,
On Tue, Jun 24, 2025 at 11:03:14AM +0800, Henry Huang wrote:
...
> We will traverse the per-CPU map information in ops.select_cpu() to select
> the appropriate CPU. To reduce the competition for the rq spinlock, tasks are
> likely to run on the CPU selected by ops.select_cpu().
>
> However, I can think of two scenarios where passive migration may occur:
> 1. set_task_allowed_cpus
> 2. cpu_stop
What do you mean by "passive migration"? The above two cases would still
travel ops.enqueue(). There are cases where ops.select_cpu()'s return value
or the local DSQ that ops.dispatch() targeted are overridden, mostly when
the CPU goes down inbetween. Are you referring to those cases?
> There may also be some passive migration scenarios that we haven't thought of.
> This could lead to incorrect information in the per-CPU map. Therefore,
> we hope to track enqueue_task_scx and dequeue_task_scx to ensure that the
> information in the per-CPU map is accurate.
Even in such cases, wouldn't something like the following work?
void my_running(struct task_struct *p)
{
struct my_task_ctx *taskc;
if (!(taskc = lookup_task_ctx(p)))
return;
if (taskc->cpu != scx_bpf_task_cpu(p)) {
/* update other stuff */
taskc->cpu = scx_bpf_task_cpu(p);
}
}
Thanks.
--
tejun
Powered by blists - more mailing lists