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
|
// 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)
|
// 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++)
|
for (usz i = 0; i < thread_count; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -1142,42 +1142,38 @@ void compressed_zstd_serialization_file_handler::finalize(utils::serial& ar)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
usz pending_threads = 0;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
pending_threads = 0;
|
||||||
|
|
||||||
for (auto& context : m_compression_threads)
|
for (auto& context : m_compression_threads)
|
||||||
{
|
{
|
||||||
// Notify to abort
|
// Try to notify all in bulk
|
||||||
while (!context.notified)
|
if (!context.notified && !context.m_input && context.m_input.compare_and_swap_test(null_ptr, empty_data))
|
||||||
{
|
|
||||||
const auto data = context.m_input.compare_and_swap(null_ptr, empty_data);
|
|
||||||
|
|
||||||
if (!data)
|
|
||||||
{
|
{
|
||||||
context.notified = true;
|
context.notified = true;
|
||||||
context.m_input.notify_one();
|
context.m_input.notify_one();
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wait until valid input is processed
|
|
||||||
thread_ctrl::wait_for(1000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& context : m_compression_threads)
|
for (auto& context : m_compression_threads)
|
||||||
{
|
{
|
||||||
// Wait for notification to be consumed
|
// Wait for notification to be sent
|
||||||
while (context.m_input)
|
// And wait for data to be written to be read by the thread
|
||||||
|
if (context.m_output || !context.notified)
|
||||||
{
|
{
|
||||||
thread_ctrl::wait_for(1000);
|
pending_threads++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& context : m_compression_threads)
|
if (pending_threads)
|
||||||
{
|
{
|
||||||
// Wait for data to be writen to be read by the thread
|
thread_ctrl::wait_for(500);
|
||||||
while (context.m_output)
|
|
||||||
{
|
|
||||||
thread_ctrl::wait_for(1000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
while (pending_threads);
|
||||||
|
|
||||||
for (usz idx = m_output_buffer_index;;)
|
for (usz idx = m_output_buffer_index;;)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue