mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-12-06 07:12:28 +01:00
SaveStates/ZSTD: Improve termination and file handling
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux-aarch64.sh, gcc, rpcs3/rpcs3-ci-jammy-aarch64:1.7, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.7, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (a1d35836e8d45bfc6f63c26f0a3e5d46ef622fe1, rpcs3/rpcs3-binaries-linux-arm64, /rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.7, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (d812f1254a1157c80fd402f94446310560f54e5f, rpcs3/rpcs3-binaries-linux, /rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.7, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (51ae32f468089a8169aaf1567de355ff4a3e0842, rpcs3/rpcs3-binaries-mac, .ci/build-mac.sh, Intel) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (8e21bdbc40711a3fccd18fbf17b742348b0f4281, rpcs3/rpcs3-binaries-mac-arm64, .ci/build-mac-arm64.sh, Apple Silicon) (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang (win64, clang, clang64) (push) Waiting to run
Build RPCS3 / RPCS3 FreeBSD (push) Waiting to run
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux-aarch64.sh, gcc, rpcs3/rpcs3-ci-jammy-aarch64:1.7, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.7, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (a1d35836e8d45bfc6f63c26f0a3e5d46ef622fe1, rpcs3/rpcs3-binaries-linux-arm64, /rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.7, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (d812f1254a1157c80fd402f94446310560f54e5f, rpcs3/rpcs3-binaries-linux, /rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.7, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (51ae32f468089a8169aaf1567de355ff4a3e0842, rpcs3/rpcs3-binaries-mac, .ci/build-mac.sh, Intel) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (8e21bdbc40711a3fccd18fbf17b742348b0f4281, rpcs3/rpcs3-binaries-mac-arm64, .ci/build-mac-arm64.sh, Apple Silicon) (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang (win64, clang, clang64) (push) Waiting to run
Build RPCS3 / RPCS3 FreeBSD (push) Waiting to run
This commit is contained in:
parent
c16278a5ab
commit
2fb8cbda38
|
|
@ -814,7 +814,7 @@ void compressed_zstd_serialization_file_handler::initialize(utils::serial& ar)
|
|||
|
||||
// Make sure at least one thread is free
|
||||
// Limit thread count in order to make sure memory limits are under control (TODO: scale with RAM size)
|
||||
const usz thread_count = std::min<u32>(std::max<u32>(utils::get_thread_count(), 2) - 1, 16);
|
||||
const usz thread_count = std::min<u32>(std::max<u32>(utils::get_thread_count(), 2) - 1, 32);
|
||||
|
||||
for (usz i = 0; i < thread_count; i++)
|
||||
{
|
||||
|
|
@ -1142,42 +1142,38 @@ void compressed_zstd_serialization_file_handler::finalize(utils::serial& ar)
|
|||
}
|
||||
}
|
||||
|
||||
for (auto& context : m_compression_threads)
|
||||
{
|
||||
// Notify to abort
|
||||
while (!context.notified)
|
||||
{
|
||||
const auto data = context.m_input.compare_and_swap(null_ptr, empty_data);
|
||||
usz pending_threads = 0;
|
||||
|
||||
if (!data)
|
||||
do
|
||||
{
|
||||
pending_threads = 0;
|
||||
|
||||
for (auto& context : m_compression_threads)
|
||||
{
|
||||
// Try to notify all in bulk
|
||||
if (!context.notified && !context.m_input && context.m_input.compare_and_swap_test(null_ptr, empty_data))
|
||||
{
|
||||
context.notified = true;
|
||||
context.m_input.notify_one();
|
||||
break;
|
||||
}
|
||||
|
||||
// Wait until valid input is processed
|
||||
thread_ctrl::wait_for(1000);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& context : m_compression_threads)
|
||||
{
|
||||
// Wait for notification to be consumed
|
||||
while (context.m_input)
|
||||
for (auto& context : m_compression_threads)
|
||||
{
|
||||
thread_ctrl::wait_for(1000);
|
||||
// Wait for notification to be sent
|
||||
// And wait for data to be written to be read by the thread
|
||||
if (context.m_output || !context.notified)
|
||||
{
|
||||
pending_threads++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& context : m_compression_threads)
|
||||
{
|
||||
// Wait for data to be writen to be read by the thread
|
||||
while (context.m_output)
|
||||
if (pending_threads)
|
||||
{
|
||||
thread_ctrl::wait_for(1000);
|
||||
thread_ctrl::wait_for(500);
|
||||
}
|
||||
}
|
||||
while (pending_threads);
|
||||
|
||||
for (usz idx = m_output_buffer_index;;)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue