diff options
| author | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-11-01 16:21:59 -0500 |
|---|---|---|
| committer | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-11-01 16:21:59 -0500 |
| commit | 350c64706510b610bef4f925fe64c3d40f4fb86a (patch) | |
| tree | d2ddc7de23bb3bb47d5b1fd94576672d1dd851c6 /src/common/host_memory.cpp | |
| parent | a41d11108b6478ad862fc7fcac36ab51c83b8602 (diff) | |
| parent | b2b5bceb51356d190969de53b1984e204ab77dc5 (diff) | |
Merge remote-tracking branch 'origin/test/linux-all-prs' into merge/nx2-experimental-1101
# Conflicts:
# src/common/host_memory.h
# src/core/hle/service/service.cpp
Diffstat (limited to 'src/common/host_memory.cpp')
| -rw-r--r-- | src/common/host_memory.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/common/host_memory.cpp b/src/common/host_memory.cpp index 868e9c68f2..b724bed1bd 100644 --- a/src/common/host_memory.cpp +++ b/src/common/host_memory.cpp @@ -793,6 +793,27 @@ void HostMemory::Protect(size_t virtual_offset, size_t length, MemoryPermission #endif } +void HostMemory::HintCold(size_t physical_offset, size_t length, + std::optional<size_t> virtual_offset) const { + if (length == 0 || backing_base == nullptr) { + return; + } + const auto hint = [length](u8* address) { +#ifdef _WIN32 + // Unlocking pages that are not locked takes them out of the working set. + VirtualUnlock(address, length); +#elif defined(__linux__) && defined(MADV_PAGEOUT) + madvise(address, length, MADV_PAGEOUT); +#else + static_cast<void>(address); +#endif + }; + hint(backing_base + physical_offset); + if (virtual_offset && virtual_base != nullptr && *virtual_offset + length <= virtual_size) { + hint(virtual_base + *virtual_offset); + } +} + void HostMemory::ClearBackingRegion(size_t physical_offset, size_t length, u32 fill_value) { if (length == 0) { return; |
