mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-03-15 09:57:56 +00:00
Kernel/SMP: Fix ProcessorMessage deallocation bug
Due to a boolean mistake in smp_return_to_pool(), we didn't retry pushing the message onto the freelist after a failed attempt. This caused the message pool to eventually become completely empty after enough contentious access attempts. This patch also adds a pause hint to the CPU in the failed attempt code path.
This commit is contained in:
@@ -668,9 +668,12 @@ void Processor::flush_tlb(Memory::PageDirectory const* page_directory, VirtualAd
|
||||
void Processor::smp_return_to_pool(ProcessorMessage& msg)
|
||||
{
|
||||
ProcessorMessage* next = nullptr;
|
||||
do {
|
||||
for (;;) {
|
||||
msg.next = next;
|
||||
} while (s_message_pool.compare_exchange_strong(next, &msg, AK::MemoryOrder::memory_order_acq_rel));
|
||||
if (s_message_pool.compare_exchange_strong(next, &msg, AK::MemoryOrder::memory_order_acq_rel))
|
||||
break;
|
||||
Processor::pause();
|
||||
}
|
||||
}
|
||||
|
||||
ProcessorMessage& Processor::smp_get_from_pool()
|
||||
|
||||
Reference in New Issue
Block a user