From: Fernand Sieber <sieberf@amazon.com>
To: K Prateek Nayak <kprateek.nayak@amd.com>
Cc: <mingo@redhat.com>, <peterz@infradead.org>,
<linux-kernel@vger.kernel.org>, <juri.lelli@redhat.com>,
<vincent.guittot@linaro.org>, <dietmar.eggemann@arm.com>,
<rostedt@goodmis.org>, <bsegall@google.com>, <mgorman@suse.de>,
<bristot@redhat.com>, <vschneid@redhat.com>, <dwmw@amazon.co.uk>,
<jschoenh@amazon.de>, <liuyuxua@amazon.com>
Subject: Re: [PATCH 4/4] sched/fair: Add more core cookie check in wake up fast path
Date: Tue, 23 Sep 2025 11:30:00 +0200 [thread overview]
Message-ID: <20250923093001.1218488-1-sieberf@amazon.com> (raw)
In-Reply-To: <a1ff6b87-48a9-436a-9b62-8664d5207884@amd.com>
Hi Prateek,
On 9/23/2025 2:25 PM, K Prateek Nayak wrote:
> So with Patch 1, you already check for cookie matching while entering
> select_idle_smt() and now, each pass of the loop again does a
> sched_core_cookie_match() which internally loops through the smt mask
> again! Seems wasteful.
Right. The change in select_idle_smt() is unnecessary.
> On an SMT-8 system, all the looping over smt mask per wakeup will add
> up. Is that not a concern? A single task with core cookie enabled will
> add massive overhead for all wakeup in the system.
In such a scenario there should generally be no looping because I introduced an
early return in patch 3 in __sched_core_cookie_match(). Perhaps it's worth
extracting this early return as standalone optimization patch? Something like
this:
@@ -1404,10 +1404,12 @@ static inline bool sched_core_cookie_match(struct rq *rq, struct task_struct *p)
if (!sched_core_enabled(rq))
return true;
+ if (rq->core->core_cookie == p->core_cookie)
+ return true;
+
for_each_cpu(cpu, cpu_smt_mask(cpu_of(rq))) {
if (!available_idle_cpu(cpu)) {
- idle_core = false;
- break;
+ return false;
}
}
@@ -1415,7 +1417,7 @@ static inline bool sched_core_cookie_match(struct rq *rq, struct task_struct *p)
* A CPU in an idle core is always the best choice for tasks with
* cookies.
*/
- return idle_core || rq->core->core_cookie == p->core_cookie;
+ return true;
}
Thanks,
Fernand
Amazon Development Centre (South Africa) (Proprietary) Limited
29 Gogosoa Street, Observatory, Cape Town, Western Cape, 7925, South Africa
Registration Number: 2004 / 034463 / 07
next prev parent reply other threads:[~2025-09-23 9:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-22 12:39 [PATCH 0/4] sched/fair: Core sched wake up path improvements Fernand Sieber
2025-09-22 12:39 ` [PATCH 1/4] sched/fair: Fix cookie check on __select_idle_cpu() Fernand Sieber
2025-09-23 8:42 ` K Prateek Nayak
2025-09-25 6:35 ` Madadi Vineeth Reddy
2025-09-22 12:39 ` [PATCH 2/4] sched/fair: Still look for the idlest cpu with no matching cookie Fernand Sieber
2025-09-23 1:51 ` K Prateek Nayak
2025-09-23 7:32 ` Fernand Sieber
2025-09-23 7:44 ` Fernand Sieber
2025-09-22 12:39 ` [PATCH 3/4] sched/fair: Add cookie checks on wake idle path Fernand Sieber
2025-09-22 12:39 ` [PATCH 4/4] sched/fair: Add more core cookie check in wake up fast path Fernand Sieber
2025-09-23 8:55 ` K Prateek Nayak
2025-09-23 9:30 ` Fernand Sieber [this message]
2025-09-24 4:21 ` K Prateek Nayak
2025-11-05 15:34 ` [PATCH 4/4] sched/fair: Add more core cookie check in wake up Fernand Sieber
2025-11-20 10:30 ` [PATCH 4/4] sched/fair: Add more core cookie check in wake up fast path Fernand Sieber
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=20250923093001.1218488-1-sieberf@amazon.com \
--to=sieberf@amazon.com \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=dwmw@amazon.co.uk \
--cc=jschoenh@amazon.de \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyuxua@amazon.com \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--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