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: <aCNniZdk-8JPBZpb@yury>
Date: Tue, 13 May 2025 11:38:49 -0400
From: Yury Norov <yury.norov@...il.com>
To: Andrea Righi <arighi@...dia.com>
Cc: linux-kernel@...r.kernel.org,
	Rasmus Villemoes <linux@...musvillemoes.dk>,
	Yicong Yang <yangyicong@...ilicon.com>, Tejun Heo <tj@...nel.org>,
	Catalin Marinas <catalin.marinas@....com>
Subject: Re: [PATCH] topology: make for_each_node_with_cpus() O(N)

On Fri, May 09, 2025 at 07:04:15PM +0200, Andrea Righi wrote:
> Hi Yury,
> 
> On Fri, May 09, 2025 at 12:20:08PM -0400, Yury Norov wrote:
> > From: Yury Norov [NVIDIA] <yury.norov@...il.com>
> > 
> > for_each_node_with_cpus() calls nr_cpus_node() at every iteration, which
> > makes it O(N^2). Kernel tracks such nodes with N_CPU record in node_states
> > array. Switching to it makes for_each_node_with_cpus() O(N).
> 
> Makes sense to me.
> 
> Maybe we should mention that previously we were only considering online
> nodes with CPUs assigned. Now, we can include also offline nodes with CPUs
> assigned (assuming it's possible)?
> 
> Semantically speaking, since the name doesn't include "online", it seems
> more logical to ignore the state of the node. And if checking the online
> state is required, the user can just use node_online() within the loop.

OK. I'll take your comment and move the patch with bitmap-for-next, if
no objections.

Thanks,
Yury

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ