lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250923093001.1218488-1-sieberf@amazon.com>
Date: Tue, 23 Sep 2025 11:30:00 +0200
From: Fernand Sieber <sieberf@...zon.com>
To: K Prateek Nayak <kprateek.nayak@....com>
CC: <mingo@...hat.com>, <peterz@...radead.org>,
	<linux-kernel@...r.kernel.org>, <juri.lelli@...hat.com>,
	<vincent.guittot@...aro.org>, <dietmar.eggemann@....com>,
	<rostedt@...dmis.org>, <bsegall@...gle.com>, <mgorman@...e.de>,
	<bristot@...hat.com>, <vschneid@...hat.com>, <dwmw@...zon.co.uk>,
	<jschoenh@...zon.de>, <liuyuxua@...zon.com>
Subject: Re: [PATCH 4/4] sched/fair: Add more core cookie check in wake up fast path

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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ