mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shubhang <sh@gentwo.org>
To: Christian Loehle <christian.loehle@arm.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	 Juri Lelli <juri.lelli@redhat.com>,
	 Vincent Guittot <vincent.guittot@linaro.org>,
	 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>,
	 K Prateek Nayak <kprateek.nayak@amd.com>,
	 "Christoph Lameter (Ampere)" <cl@gentwo.org>,
	 Shubhang Kaushik <shubhang@os.amperecomputing.com>,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/fair: Prefer waker CPU for reciprocal sync wakeups
Date: Wed, 22 Jul 2026 11:06:42 -0700 (PDT)	[thread overview]
Message-ID: <82b8ff02-a7c8-e9d0-1d6d-3628819089f7@gentwo.org> (raw)
In-Reply-To: <2aadc9bb-43d8-403d-a5ec-321c0f428026@arm.com>

Hi Christian,

Thanks for the review.

On Wed, 22 Jul 2026, Christian Loehle wrote:

> On 7/22/26 01:04, Shubhang Kaushik (Ampere) wrote:
>> Pipe and futex 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
>> ...
>
> But the futex ping-pong doesn't set WF_SYNC in the first place or am I missing
> something?

Yes, the futex runs were only regression checks here. I'll drop the futex 
wording from the description and keep the motivation to pipe sync 
handoffs.

>> @@ -9548,6 +9570,7 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int wake_flags)
>>  	int cpu = smp_processor_id();
>>  	int new_cpu = prev_cpu;
>>  	int want_affine = 0;
>> +	int wide = 0;
>>  	/* SD_flags and WF_flags share the first nibble */
>>  	int sd_flag = wake_flags & 0xF;
>>
>> @@ -9557,6 +9580,7 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int wake_flags)
>>  	lockdep_assert_held(&p->pi_lock);
>>  	if (wake_flags & WF_TTWU) {
>>  		record_wakee(p);
>> +		wide = wake_wide(p);
>>
>>  		if ((wake_flags & WF_CURRENT_CPU) &&
>>  		    cpumask_test_cpu(cpu, p->cpus_ptr))
>> @@ -9569,7 +9593,12 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int wake_flags)
>>  			new_cpu = prev_cpu;
>>  		}
>>
>> -		want_affine = !wake_wide(p) && cpumask_test_cpu(cpu, p->cpus_ptr);
>> +		if (sync && !wide &&
>> +		    READ_ONCE(p->last_wakee) == current &&
>> +		    prefer_sync_pair_cpu(p, cpu))
>> +			return cpu;
>
> This must move further below (to check for SD_WAKE_AFFINE) otherwise it ignores isolcpus.

Agreed. The early return bypasses the existing SD_WAKE_AFFINE check,
including the isolcpus handling that comes through the sched-domain
setup. I'll move it into the wake-affine block so it only applies after
that check.

Regards,
Shubhang Kaushik

      reply	other threads:[~2026-07-22 18:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22  0:04 Shubhang Kaushik (Ampere)
2026-07-22 12:37 ` Christian Loehle
2026-07-22 18:06   ` Shubhang [this message]

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=82b8ff02-a7c8-e9d0-1d6d-3628819089f7@gentwo.org \
    --to=sh@gentwo.org \
    --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=shubhang@os.amperecomputing.com \
    --cc=vincent.guittot@linaro.org \
    --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

all inboxes | Powered by JetHome®