Skip to content
Commit 895ee6a2 authored by Yury Norov [NVIDIA]'s avatar Yury Norov [NVIDIA] Committed by Yury Norov
Browse files

topology: make for_each_node_with_cpus() O(N)



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).

Andrea:

Now we can include also offline nodes with CPUs assigned (assuming it's
possible). If checking the online state is required, the user must use
node_online() within the loop.

CC: Andrea Righi <arighi@nvidia.com>
CC:Tejun Heo <tj@kernel.org>
Signed-off-by: default avatarYury Norov [NVIDIA] <yury.norov@gmail.com>
parent a256ae22
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment