From: sashiko-bot@kernel.org
To: "Shrikanth Hegde" <sshegde@linux.ibm.com>
Cc: virtualization@lists.linux.dev,
"Eugenio Perez" <eperezma@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH v13 06/13] sched/core: Try to use a preferred CPU in is_cpu_allowed
Date: Wed, 09 Sep 2026 14:18:14 +0000 [thread overview]
Message-ID: <20260909141814.BAF841F00A3E@smtp.kernel.org> (raw)
In-Reply-To: <20260909135617.871006-7-sshegde@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Wakeup path funneling to lowest-ID preferred CPU bypassing CFS load balancing
--
commit 2b5645419bf5356450334e7129102cfed3b5f5bf
Author: Shrikanth Hegde <sshegde@linux.ibm.com>
sched/core: Try to use a preferred CPU in is_cpu_allowed
When possible, try to choose a preferred CPU to maintain user affinities
when preferred CPUs change. Update is_cpu_allowed() to ensure wakeups
happen on preferred CPUs.
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index a689a0cea4ebe..b4ef2e92d786b 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
[ ... ]
> @@ -2519,8 +2536,12 @@ static inline bool is_cpu_allowed(struct task_struct *p, int cpu)
> return cpu_online(cpu);
>
> /* Non kernel threads are not allowed during either online or offline. */
> - if (!(p->flags & PF_KTHREAD))
> + if (!(p->flags & PF_KTHREAD)) {
> + /* Try to use preferred CPU if task's affinity allows */
> + if (task_can_sched_on_preferred(cpu, p))
> + return false;
[Severity: High]
Does returning false here for non-preferred CPUs cause FAIR wakeups to funnel
into a single CPU and bypass CFS load balancing?
When a FAIR task wakes up, select_task_rq_fair() and select_idle_sibling()
search for an idle CPU. Because select_idle_sibling() remains unaware of
cpu_preferred_mask, it can actively select an idle non-preferred CPU.
When this selected CPU is checked after the scheduler class's placement
decision, is_cpu_allowed() will now hard-reject it. This forces
select_task_rq() into the slow path:
cpu = p->sched_class->select_task_rq(p, task_cpu(p), wake_flags);
if (unlikely(!is_cpu_allowed(p, cpu)))
cpu = select_fallback_rq(task_cpu(p), p);
Because select_fallback_rq() sequentially searches the mask:
for_each_cpu(dest_cpu, nodemask) {
if (is_cpu_allowed(p, dest_cpu))
return dest_cpu;
}
Will this cause waking tasks to be dumped repeatedly onto the lowest-ID
preferred CPU, creating massive runqueue hotspots?
> return cpu_active(cpu);
> + }
>
> /* KTHREAD_IS_PER_CPU is always allowed. */
> if (kthread_is_per_cpu(p))
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260909135617.871006-1-sshegde@linux.ibm.com?part=6
next prev parent reply other threads:[~2026-09-09 14:18 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 13:56 [PATCH v13 00/13] sched, steal_governor: Introduce preferred CPUs and steal-driven vCPU backoff Shrikanth Hegde
2026-09-09 13:56 ` [PATCH v13 01/13] sched/cputime: Add kcpustat_field_total helper Shrikanth Hegde
2026-09-09 14:16 ` sashiko-bot
2026-09-09 13:56 ` [PATCH v13 02/13] cpumask: Introduce cpumask_intersects_and Shrikanth Hegde
2026-09-09 14:02 ` sashiko-bot
2026-09-09 16:03 ` Yury Norov
2026-09-09 13:56 ` [PATCH v13 03/13] sched/docs: Document cpu_preferred_mask and Preferred CPU concept Shrikanth Hegde
2026-09-09 14:01 ` sashiko-bot
2026-09-09 13:56 ` [PATCH v13 04/13] cpumask: Introduce cpu_preferred_mask Shrikanth Hegde
2026-09-09 14:06 ` sashiko-bot
2026-09-09 13:56 ` [PATCH v13 05/13] sysfs: Add preferred CPU file Shrikanth Hegde
2026-09-09 14:04 ` sashiko-bot
2026-09-09 13:56 ` [PATCH v13 06/13] sched/core: Try to use a preferred CPU in is_cpu_allowed Shrikanth Hegde
2026-09-09 14:18 ` sashiko-bot [this message]
2026-09-09 16:49 ` Shrikanth Hegde
2026-09-09 13:56 ` [PATCH v13 07/13] sched/fair: Load balance only among preferred CPUs Shrikanth Hegde
2026-09-09 14:33 ` sashiko-bot
2026-09-09 17:09 ` Shrikanth Hegde
2026-09-09 17:19 ` Yury Norov
2026-09-09 13:56 ` [PATCH v13 08/13] sched/core: Push current task from non preferred CPU Shrikanth Hegde
2026-09-09 14:18 ` sashiko-bot
2026-09-09 13:56 ` [PATCH v13 09/13] sched/debug: Add migration stats due to non preferred CPUs Shrikanth Hegde
2026-09-09 14:07 ` sashiko-bot
2026-09-09 13:56 ` [PATCH v13 10/13] virt: Introduce steal governor driver Shrikanth Hegde
2026-09-09 14:09 ` sashiko-bot
2026-09-09 13:56 ` [PATCH v13 11/13] virt/steal_governor: Add control knobs for handling steal values Shrikanth Hegde
2026-09-09 14:06 ` sashiko-bot
2026-09-09 13:56 ` [PATCH v13 12/13] virt/steal_governor: Implement steal_governor policy loop Shrikanth Hegde
2026-09-09 14:16 ` sashiko-bot
2026-09-09 16:52 ` Shrikanth Hegde
2026-09-09 13:56 ` [PATCH v13 13/13] virt/steal_governor: Enable the driver Shrikanth Hegde
2026-09-09 14:17 ` sashiko-bot
2026-09-09 16:58 ` Shrikanth Hegde
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=20260909141814.BAF841F00A3E@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=eperezma@redhat.com \
--cc=mst@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sshegde@linux.ibm.com \
--cc=virtualization@lists.linux.dev \
/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