mirror of
https://github.com/skyline-emu/skyline.git
synced 2025-01-16 22:47:55 +03:00
Fix KProcess
/SetThreadPriority
PI CAS
The condition for exiting the CAS loops is incorrect in several places which leads to additional loops, while this doesn't make the behavior incorrect it does lead to redundant iterations. Co-authored-by: Billy Laws <blaws05@gmail.com>
This commit is contained in:
parent
8fc3cc7a16
commit
68615703c1
@ -365,7 +365,7 @@ namespace skyline::kernel::svc {
|
|||||||
// If the new priority is equivalent to the current priority then we don't need to CAS
|
// If the new priority is equivalent to the current priority then we don't need to CAS
|
||||||
newPriority = thread->priority.load();
|
newPriority = thread->priority.load();
|
||||||
newPriority = std::min(newPriority, priority);
|
newPriority = std::min(newPriority, priority);
|
||||||
} while (newPriority != priority && thread->priority.compare_exchange_strong(newPriority, priority));
|
} while (newPriority != priority && !thread->priority.compare_exchange_strong(newPriority, priority));
|
||||||
state.scheduler->UpdatePriority(thread);
|
state.scheduler->UpdatePriority(thread);
|
||||||
thread->UpdatePriorityInheritance();
|
thread->UpdatePriorityInheritance();
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ namespace skyline::kernel::type {
|
|||||||
do {
|
do {
|
||||||
basePriority = state.thread->basePriority.load();
|
basePriority = state.thread->basePriority.load();
|
||||||
newPriority = std::min(basePriority, highestPriorityThread->priority.load());
|
newPriority = std::min(basePriority, highestPriorityThread->priority.load());
|
||||||
} while (basePriority != newPriority && state.thread->priority.compare_exchange_strong(basePriority, newPriority));
|
} while (basePriority != newPriority && !state.thread->priority.compare_exchange_strong(basePriority, newPriority));
|
||||||
state.scheduler->UpdatePriority(state.thread);
|
state.scheduler->UpdatePriority(state.thread);
|
||||||
} else {
|
} else {
|
||||||
i8 priority, basePriority;
|
i8 priority, basePriority;
|
||||||
@ -199,7 +199,7 @@ namespace skyline::kernel::type {
|
|||||||
do {
|
do {
|
||||||
ownerPriority = nextOwner->priority.load();
|
ownerPriority = nextOwner->priority.load();
|
||||||
priority = std::min(ownerPriority, nextWaiter->priority.load());
|
priority = std::min(ownerPriority, nextWaiter->priority.load());
|
||||||
} while (ownerPriority != priority && nextOwner->priority.compare_exchange_strong(ownerPriority, priority));
|
} while (ownerPriority != priority && !nextOwner->priority.compare_exchange_strong(ownerPriority, priority));
|
||||||
|
|
||||||
__atomic_store_n(mutex, nextOwner->waitTag | HandleWaitersBit, __ATOMIC_SEQ_CST);
|
__atomic_store_n(mutex, nextOwner->waitTag | HandleWaitersBit, __ATOMIC_SEQ_CST);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user