Sched_ext development
 help / color / mirror / Atom feed
From: Kuba Piecuch <jpiecuch@google.com>
To: Cheng-Yang Chou <yphbchou0911@gmail.com>,
	<sched-ext@lists.linux.dev>,  Tejun Heo <tj@kernel.org>,
	David Vernet <void@manifault.com>,
	Andrea Righi <arighi@nvidia.com>,
	 Changwoo Min <changwoo@igalia.com>
Cc: Ching-Chun Huang <jserv@ccns.ncku.edu.tw>,
	Chia-Ping Tsai <chia7712@gmail.com>
Subject: Re: [PATCH] tools/sched_ext: Handle pinned tasks in scx_central
Date: Mon, 13 Apr 2026 15:29:37 +0000	[thread overview]
Message-ID: <DHS4U9BLRCPG.1S9E4BT1UIHQT@google.com> (raw)
In-Reply-To: <20260413110453.357198-1-yphbchou0911@gmail.com>

Hi Cheng-Yang,

On Mon Apr 13, 2026 at 11:04 AM UTC, Cheng-Yang Chou wrote:
> @@ -107,12 +113,13 @@ void BPF_STRUCT_OPS(central_enqueue, struct task_struct *p, u64 enq_flags)
>  	__sync_fetch_and_add(&nr_total, 1);
>  
>  	/*
> -	 * Push per-cpu kthreads at the head of local dsq's and preempt the
> -	 * corresponding CPU. This ensures that e.g. ksoftirqd isn't blocked
> -	 * behind other threads which is necessary for forward progress
> -	 * guarantee as we depend on the BPF timer which may run from ksoftirqd.
> +	 * Push tasks pinned to a single CPU at the head of local dsq's and
> +	 * preempt the corresponding CPU. This ensures that e.g. ksoftirqd
> +	 * isn't blocked behind other threads which is necessary for forward
> +	 * progress guarantee as we depend on the BPF timer which may run
> +	 * from ksoftirqd.
>  	 */
> -	if ((p->flags & PF_KTHREAD) && p->nr_cpus_allowed == 1) {
> +	if (p->nr_cpus_allowed == 1) {

If you want to cover all cases, then I think you should also check
is_migration_disabled(p). When a task disables migration, it is not reflected
in p->cpus_ptr or p->nr_cpus_allowed until the task is switched out (see
migrate_disable_switch()), which happens __after__ ops.enqueue().
So here, you could see p->nr_cpus_allowed > 1 even though the task has
migration disabled.

Thanks,
Kuba

  reply	other threads:[~2026-04-13 15:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-13 11:04 [PATCH] tools/sched_ext: Handle pinned tasks in scx_central Cheng-Yang Chou
2026-04-13 15:29 ` Kuba Piecuch [this message]
2026-04-14  3:45   ` Cheng-Yang Chou
2026-04-14 17:19     ` Tejun Heo
2026-04-15  6:17       ` Cheng-Yang Chou
2026-04-15  9:59         ` Kuba Piecuch
2026-04-15 10:07           ` Cheng-Yang Chou
2026-04-17 18:38         ` Tejun Heo
2026-04-14 21:01     ` Andrea Righi
2026-04-15  6:02       ` Cheng-Yang Chou

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=DHS4U9BLRCPG.1S9E4BT1UIHQT@google.com \
    --to=jpiecuch@google.com \
    --cc=arighi@nvidia.com \
    --cc=changwoo@igalia.com \
    --cc=chia7712@gmail.com \
    --cc=jserv@ccns.ncku.edu.tw \
    --cc=sched-ext@lists.linux.dev \
    --cc=tj@kernel.org \
    --cc=void@manifault.com \
    --cc=yphbchou0911@gmail.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