mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Henry Huang <henry.hj@antgroup.com>
Cc: arighi@nvidia.com, changwoo@igalia.com,
	谈鉴锋 <henry.tjf@antgroup.com>,
	linux-kernel@vger.kernel.org, sched-ext@lists.linux.dev,
	void@manifault.com, "Yan Yan(cailing)" <yanyan.yan@antgroup.com>
Subject: Re: [PATCH v3] sched_ext: include SCX_OPS_TRACK_MIGRATION
Date: Wed, 25 Jun 2025 13:07:04 -1000	[thread overview]
Message-ID: <aFyBGAce73hzbPhQ@slm.duckdns.org> (raw)
In-Reply-To: <20250624030314.48808-1-henry.hj@antgroup.com>

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

  reply	other threads:[~2025-06-25 23:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-23  6:30 [PATCH v3] Implement SCX_OPS_TRACK_MIGRATION Henry Huang
2025-06-23  6:30 ` [PATCH v3] sched_ext: " Henry Huang
2025-06-23  6:42   ` Andrea Righi
2025-06-23 17:59   ` Tejun Heo
2025-06-24  3:03     ` [PATCH v3] sched_ext: include SCX_OPS_TRACK_MIGRATION Henry Huang
2025-06-25 23:07       ` Tejun Heo [this message]
2025-06-27  3:43         ` [PATCH v3] sched_ext: Implement SCX_OPS_TRACK_MIGRATION Henry Huang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aFyBGAce73hzbPhQ@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=arighi@nvidia.com \
    --cc=changwoo@igalia.com \
    --cc=henry.hj@antgroup.com \
    --cc=henry.tjf@antgroup.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sched-ext@lists.linux.dev \
    --cc=void@manifault.com \
    --cc=yanyan.yan@antgroup.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®