diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-01-01 16:24:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-01 16:24:07 +0100 |
commit | 92103d4ff3dfff541a6cb1b2c54a9b0646a35806 (patch) | |
tree | 770fe1892e16878aa26e130935e93f76ce6e6841 | |
parent | Merge pull request #9532 from zhaobot/tx-update-20230101024213 (diff) | |
parent | host_memory: Use transparent huge pages where available (diff) | |
download | yuzu-92103d4ff3dfff541a6cb1b2c54a9b0646a35806.tar yuzu-92103d4ff3dfff541a6cb1b2c54a9b0646a35806.tar.gz yuzu-92103d4ff3dfff541a6cb1b2c54a9b0646a35806.tar.bz2 yuzu-92103d4ff3dfff541a6cb1b2c54a9b0646a35806.tar.lz yuzu-92103d4ff3dfff541a6cb1b2c54a9b0646a35806.tar.xz yuzu-92103d4ff3dfff541a6cb1b2c54a9b0646a35806.tar.zst yuzu-92103d4ff3dfff541a6cb1b2c54a9b0646a35806.zip |
Diffstat (limited to '')
-rw-r--r-- | src/common/host_memory.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/common/host_memory.cpp b/src/common/host_memory.cpp index 909f6cf3f..611c7d1a3 100644 --- a/src/common/host_memory.cpp +++ b/src/common/host_memory.cpp @@ -393,12 +393,27 @@ public: } // Virtual memory initialization - virtual_base = static_cast<u8*>( - mmap(nullptr, virtual_size, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)); +#if defined(__FreeBSD__) + virtual_base = + static_cast<u8*>(mmap(nullptr, virtual_size, PROT_NONE, + MAP_PRIVATE | MAP_ANONYMOUS | MAP_ALIGNED_SUPER, -1, 0)); + if (virtual_base == MAP_FAILED) { + virtual_base = static_cast<u8*>( + mmap(nullptr, virtual_size, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)); + if (virtual_base == MAP_FAILED) { + LOG_CRITICAL(HW_Memory, "mmap failed: {}", strerror(errno)); + throw std::bad_alloc{}; + } + } +#else + virtual_base = static_cast<u8*>(mmap(nullptr, virtual_size, PROT_NONE, + MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0)); if (virtual_base == MAP_FAILED) { LOG_CRITICAL(HW_Memory, "mmap failed: {}", strerror(errno)); throw std::bad_alloc{}; } + madvise(virtual_base, virtual_size, MADV_HUGEPAGE); +#endif good = true; } |