]> git.baikalelectronics.ru Git - kernel.git/commitdiff
arch_topology: Avoid parsing through all the CPUs once a outlier CPU is found
authorSudeep Holla <sudeep.holla@arm.com>
Mon, 4 Jul 2022 10:15:59 +0000 (11:15 +0100)
committerSudeep Holla <sudeep.holla@arm.com>
Mon, 4 Jul 2022 15:22:29 +0000 (16:22 +0100)
There is no point in looping through all the CPU's physical package
identifier to check if it is valid or not once a CPU which is outside
the topology(i.e. outlier CPU) is found.

Let us just break out of the loop early in such case.

Link: https://lore.kernel.org/r/20220704101605.1318280-16-sudeep.holla@arm.com
Tested-by: Ionela Voinescu <ionela.voinescu@arm.com>
Tested-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
drivers/base/arch_topology.c

index c0b0ee64a79dbb445fcc84c9e52baad43cd623ba..8f6a964d2512122fb5ce34bbda58b663c69e2d83 100644 (file)
@@ -642,8 +642,10 @@ static int __init parse_dt_topology(void)
         * only mark cores described in the DT as possible.
         */
        for_each_possible_cpu(cpu)
-               if (cpu_topology[cpu].package_id < 0)
+               if (cpu_topology[cpu].package_id < 0) {
                        ret = -EINVAL;
+                       break;
+               }
 
 out_map:
        of_node_put(map);