kernel/smp: Just return free messages using a write spinlock.

There isn't much value in using extra atomics here.
This commit is contained in:
Augustin Cavalier
2026-03-10 15:21:27 -04:00
parent 3c28d298f7
commit 334e90a2ac
+4 -9
View File
@@ -722,16 +722,11 @@ return_free_message(struct smp_msg* msg)
{
TRACE("return_free_message: returning msg %p\n", msg);
acquire_read_spinlock_nocheck(&sFreeMessageSpinlock);
acquire_write_spinlock_nocheck(&sFreeMessageSpinlock);
msg->next = sFreeMessages;
while (true) {
smp_msg* result = atomic_pointer_test_and_set(&sFreeMessages, msg, msg->next);
if (result == msg->next)
break;
msg->next = result;
}
atomic_add(&sFreeMessageCount, 1);
release_read_spinlock(&sFreeMessageSpinlock);
sFreeMessages = msg;
sFreeMessageCount++;
release_write_spinlock(&sFreeMessageSpinlock);
}