Fix donate_priority to disable interrupts for entire update of possibly-ready donatee's priority

This commit is contained in:
Themis Demetriades
2024-10-23 14:10:48 +01:00
parent b0074c80f0
commit 5f8dea21be

View File

@@ -210,23 +210,25 @@ donate_priority (struct thread *donee) {
if (donor->priority <= donee->priority)
break;
donee->priority = donor->priority;
/* Also stop propagation of donation once a donee is reached with
no donees of its own (sink node in WFG). */
if (donee->waiting_lock == NULL)
{
/* Only the sink node of the WFG isn't waiting for a lock and
could be on the ready list. Thus, as its priority changed,
it must be reinserted into the list. */
enum intr_level old_level = intr_disable ();
donee->priority = donor->priority;
ready_list_reinsert (donee);
intr_set_level (old_level);
donee = NULL;
}
else
donee = donee->waiting_lock->holder;
{
donee->priority = donor->priority;
donee = donee->waiting_lock->holder;
}
}
}