Skip to content

Commit 20bd32c

Browse files
authored
[arm] fix the logic for identifying the valid processors (#197)
The current logic for valid processor detection is reporting all cpus irrespective of whether they are online or not. so, it's causing thread over-subscription for the scenarios where the online cpu count < the actual cpus. This is fixed by publishing only the online cpu count as the valid processors.
1 parent 9f13d15 commit 20bd32c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/arm/linux/init.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,13 @@ void cpuinfo_arm_linux_init(void) {
199199
for (uint32_t i = 0; i < arm_linux_processors_count; i++) {
200200
arm_linux_processors[i].system_processor_id = i;
201201
if (bitmask_all(arm_linux_processors[i].flags, CPUINFO_LINUX_FLAG_VALID)) {
202-
valid_processors += 1;
203-
204-
if (!(arm_linux_processors[i].flags & CPUINFO_ARM_LINUX_VALID_PROCESSOR)) {
202+
if (arm_linux_processors[i].flags & CPUINFO_ARM_LINUX_VALID_PROCESSOR) {
203+
/*
204+
* Processor is in possible and present lists, and also reported in /proc/cpuinfo.
205+
* This processor is availble for compute.
206+
*/
207+
valid_processors += 1;
208+
} else {
205209
/*
206210
* Processor is in possible and present lists, but not reported in /proc/cpuinfo.
207211
* This is fairly common: high-index processors can be not reported if they are offline.

0 commit comments

Comments
 (0)