mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
Improve cpu_thread::suspend_all (TSX-FA)
Add prefetching of cpu->state fields.
This commit is contained in:
parent
120849c734
commit
a5eb11d79f
@ -782,6 +782,15 @@ bool cpu_thread::suspend_work::push(cpu_thread* _this, bool cancel_if_not_suspen
|
||||
// First thread to push the work to the workload list pauses all threads and processes it
|
||||
std::lock_guard lock(ctr->cpu_suspend_lock);
|
||||
|
||||
// Try to prefetch cpu->state earlier
|
||||
for_all_cpu([&](cpu_thread* cpu)
|
||||
{
|
||||
if (cpu != _this)
|
||||
{
|
||||
_m_prefetchw(&cpu->state);
|
||||
}
|
||||
});
|
||||
|
||||
// Copy of thread bits
|
||||
decltype(ctr->cpu_copy_bits) copy2{};
|
||||
|
||||
@ -804,8 +813,6 @@ bool cpu_thread::suspend_work::push(cpu_thread* _this, bool cancel_if_not_suspen
|
||||
}
|
||||
});
|
||||
|
||||
busy_wait(500);
|
||||
|
||||
while (std::accumulate(std::begin(ctr->cpu_copy_bits), std::end(ctr->cpu_copy_bits), u64{0}, std::bit_or()))
|
||||
{
|
||||
// Check only CPUs which haven't acknowledged their waiting state yet
|
||||
@ -842,6 +849,13 @@ bool cpu_thread::suspend_work::push(cpu_thread* _this, bool cancel_if_not_suspen
|
||||
while (prev);
|
||||
}
|
||||
|
||||
for_all_cpu<true>([&](cpu_thread* cpu)
|
||||
{
|
||||
_m_prefetchw(&cpu->state);
|
||||
});
|
||||
|
||||
_m_prefetchw(&g_suspend_counter);
|
||||
|
||||
// Execute all stored workload
|
||||
for (s32 prio = max_prio; prio >= min_prio; prio--)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user