mirror of
https://github.com/xmrig/xmrig.git
synced 2025-01-30 14:36:00 +00:00
Add AUTO_HUGEPAGE feature to disable writing to nr_hugepages
This commit is contained in:
parent
e7de104d88
commit
6c8098378a
2 changed files with 9 additions and 0 deletions
|
@ -32,6 +32,7 @@ option(WITH_VAES "Enable VAES instructions for Cryptonight" ON)
|
|||
option(WITH_BENCHMARK "Enable builtin RandomX benchmark and stress test" ON)
|
||||
option(WITH_SECURE_JIT "Enable secure access to JIT memory" OFF)
|
||||
option(WITH_DMI "Enable DMI/SMBIOS reader" ON)
|
||||
option(WITH_AUTO_HUGEPAGE "Enable Automatic setting of nr_hugepages (Linux Only)" ON)
|
||||
|
||||
option(BUILD_STATIC "Build static binary" OFF)
|
||||
option(ARM_V8 "Force ARMv8 (64 bit) architecture, use with caution if automatic detection fails, but you sure it may work" OFF)
|
||||
|
@ -181,6 +182,10 @@ else()
|
|||
if (XMRIG_OS_ANDROID)
|
||||
set(EXTRA_LIBS pthread rt dl log)
|
||||
elseif (XMRIG_OS_LINUX)
|
||||
if (WITH_AUTO_HUGEPAGE)
|
||||
add_definitions(/DXMRIG_FEATURE_AUTO_HUGEPAGE)
|
||||
endif()
|
||||
|
||||
list(APPEND SOURCES_OS
|
||||
src/crypto/common/LinuxMemory.h
|
||||
src/crypto/common/LinuxMemory.cpp
|
||||
|
|
|
@ -60,7 +60,11 @@ bool xmrig::LinuxMemory::reserve(size_t size, uint32_t node, size_t hugePageSize
|
|||
return false;
|
||||
}
|
||||
|
||||
# ifdef XMRIG_FEATURE_AUTO_HUGEPAGE
|
||||
return write_nr_hugepages(node, hugePageSize, std::max<size_t>(nr_hugepages(node, hugePageSize), 0) + (required - available));
|
||||
# else
|
||||
return false;
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue