From: Shrikanth Hegde <sshegde@linux.ibm.com>
To: "Shubhang Kaushik (Ampere)" <sh@gentwo.org>,
K Prateek Nayak <kprateek.nayak@amd.com>,
Madadi Vineeth Reddy <vineethr@linux.ibm.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>
Cc: "Christoph Lameter (Ampere)" <cl@gentwo.org>,
Juri Lelli <juri.lelli@redhat.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
Christian Loehle <christian.loehle@arm.com>,
linux-kernel@vger.kernel.org,
Shubhang Kaushik <shubhang@os.amperecomputing.com>
Subject: Re: [PATCH v3] sched/fair: Prefer waker CPU for non-SMT reciprocal sync wakeups
Date: Mon, 3 Aug 2026 19:35:39 +0530 [thread overview]
Message-ID: <a52b4ee4-381d-4dbc-b05d-13ea7975f176@linux.ibm.com> (raw)
In-Reply-To: <20260727-b4-sched-sync-wakeup-v3-1-90cf481dbd85@gentwo.org>
Hello.
After seeing this and vineeth's patch,
https://lore.kernel.org/all/20260801035532.260625-1-vineethr@linux.ibm.com/
I am bit confused on the policy we are trying to do for sync. Find the details
below.
On 7/28/26 5:28 AM, Shubhang Kaushik (Ampere) wrote:
> Pipe-style ping-pong workloads can be dominated by handoff cost. In
> such cases, placing the wakee on an idle CPU can be slower than keeping
> the pair on the same runqueue.
>
> Use the existing last_wakee and wake_wide() state to identify narrow
> reciprocal WF_SYNC wakeups:
>
> A wakes B
> B wakes A
> A wakes B
> ...
>
> When the wake-affine domain allows SD_WAKE_AFFINE, prefer the waker CPU
> for these narrow reciprocal handoffs on non-SMT systems. Do so only when
> the waker CPU has no other runnable fair task and the wakee fits there on
> asymmetric-capacity systems.
>
> SMT systems, and wakeups that do not match this pattern, continue through
> the existing wake_affine() and select_idle_sibling() path.
>
I think we need to think this on the policy notion rather than a usecase specific.
These are api's available to other susystems to make specific call based on its
understand of its requirement. i.e
wake_up_interruptible_sync_poll
vs
wake_up, wake_up_interruptible
If we look at __wake_up_sync*, It says,
/**
* __wake_up_sync_key - wake up threads blocked on a waitqueue.
* @wq_head: the waitqueue
* @mode: which threads
* @key: opaque value to be passed to wakeup targets
*
* The sync wakeup differs that the waker knows that it will schedule
* away soon, so while the target thread will be woken up, it will not
* be migrated to another CPU - ie. the two threads are 'synchronized'
* with each other. This can prevent needless bouncing between CPUs.
*
* On UP it can prevent extra preemption.
*
* If this function wakes up a task, it executes a full memory barrier before
* accessing the task state.
*/
void __wake_up_sync_key(struct wait_queue_head *wq_head, unsigned int mode,
void *key)
{
if (unlikely(!wq_head))
return;
__wake_up_common_lock(wq_head, mode, 1, WF_SYNC, key);
}
So, with that, we use introduce the notion that, scheduler wakeup will honor
the sync behaviour based on underlying arch/hw, how will callers ever
know. For example, same SMT system can have all its siblings off, and now it
is !smt system.
There is already use/abuse of sync api in Networking staff.
A recent discussion on it,
https://lore.kernel.org/all/amI22o9MwDoGcBMl@linux.ibm.com/
I am assuming there would be more.
So, What should sync wakeup should do vs non-sync wakeup?
- Should it chose waker's CPU if waker is the only one running.
- Should it be always?
- Should it be under specific case such !smt, cas specific?
- Should it still chose an idle core first, if not chose waker CPU/Sibling?
- Should it fallback to waker's LLC vs current LLC. and then choose a CPU
in that LLC or choose a recently used cpu, prev_cpu etc? (Current logic)
I think we should define the policy for it. (if it is not too late for it)
No?
next prev parent reply other threads:[~2026-08-03 14:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-27 23:58 [PATCH v3] sched/fair: Prefer waker CPU for non-SMT reciprocal sync wakeups Shubhang Kaushik (Ampere)
2026-07-30 6:27 ` K Prateek Nayak
2026-07-31 7:22 ` Shubhang
2026-08-01 4:03 ` Madadi Vineeth Reddy
2026-08-03 14:05 ` Shrikanth Hegde [this message]
2026-08-04 0:10 ` Shubhang
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=a52b4ee4-381d-4dbc-b05d-13ea7975f176@linux.ibm.com \
--to=sshegde@linux.ibm.com \
--cc=bsegall@google.com \
--cc=christian.loehle@arm.com \
--cc=cl@gentwo.org \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sh@gentwo.org \
--cc=shubhang@os.amperecomputing.com \
--cc=vincent.guittot@linaro.org \
--cc=vineethr@linux.ibm.com \
--cc=vschneid@redhat.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