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:
@@ -722,16 +722,11 @@ return_free_message(struct smp_msg* msg)
|
|||||||
{
|
{
|
||||||
TRACE("return_free_message: returning msg %p\n", msg);
|
TRACE("return_free_message: returning msg %p\n", msg);
|
||||||
|
|
||||||
acquire_read_spinlock_nocheck(&sFreeMessageSpinlock);
|
acquire_write_spinlock_nocheck(&sFreeMessageSpinlock);
|
||||||
msg->next = sFreeMessages;
|
msg->next = sFreeMessages;
|
||||||
while (true) {
|
sFreeMessages = msg;
|
||||||
smp_msg* result = atomic_pointer_test_and_set(&sFreeMessages, msg, msg->next);
|
sFreeMessageCount++;
|
||||||
if (result == msg->next)
|
release_write_spinlock(&sFreeMessageSpinlock);
|
||||||
break;
|
|
||||||
msg->next = result;
|
|
||||||
}
|
|
||||||
atomic_add(&sFreeMessageCount, 1);
|
|
||||||
release_read_spinlock(&sFreeMessageSpinlock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user