kernel: fix race condition on boot, using SetBitAtomic

fix #18915

Change-Id: Ia8829822e21f6d6b765746ddab05f8781385745f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7777
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: Fredrik Holmqvist <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
Jérôme Duval
2024-06-14 06:07:23 +00:00
parent 8b32e9b4ac
commit 43db77b370
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -150,7 +150,7 @@ cpu_preboot_init_percpu(kernel_args *args, int curr_cpu)
// we can use it for get_current_cpu
memset(&gCPU[curr_cpu], 0, sizeof(gCPU[curr_cpu]));
gCPU[curr_cpu].cpu_num = curr_cpu;
gCPUEnabled.SetBit(curr_cpu);
gCPUEnabled.SetBitAtomic(curr_cpu);
list_init(&gCPU[curr_cpu].irqs);
B_INITIALIZE_SPINLOCK(&gCPU[curr_cpu].irqs_lock);
+1 -1
View File
@@ -379,7 +379,7 @@ reschedule(int32 nextState)
// select thread with the biggest priority and enqueue back the old thread
ThreadData* nextThreadData;
if (gCPU[thisCPU].disabled) {
if (!gCPUEnabled.GetBit(thisCPU)) {
if (!oldThreadData->IsIdle()) {
if (oldThread->pinned_to_cpu == 0) {
putOldThreadAtBack = true;