diff --git a/src/Summary.cpp b/src/Summary.cpp index 227fdcc80..2b8939a7a 100644 --- a/src/Summary.cpp +++ b/src/Summary.cpp @@ -23,8 +23,8 @@ */ -#include -#include +#include +#include #include @@ -59,10 +59,10 @@ inline static const char *asmName(Assembly::Id assembly) #endif -static void print_memory(Config *) { +static void print_memory(Config *config) { # ifdef _WIN32 Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") "%s", - "HUGE PAGES", VirtualMemory::isHugepagesAvailable() ? GREEN_BOLD("permission granted") : RED_BOLD("unavailable")); + "HUGE PAGES", config->cpu().isHugePages() ? (VirtualMemory::isHugepagesAvailable() ? GREEN_BOLD("permission granted") : RED_BOLD("unavailable")) : RED_BOLD("disabled")); # endif } diff --git a/src/crypto/common/VirtualMemory.cpp b/src/crypto/common/VirtualMemory.cpp index 66d29061f..0eaef3c5e 100644 --- a/src/crypto/common/VirtualMemory.cpp +++ b/src/crypto/common/VirtualMemory.cpp @@ -112,7 +112,7 @@ void xmrig::VirtualMemory::destroy() void xmrig::VirtualMemory::init(size_t poolSize, bool hugePages) { if (!pool) { - osInit(); + osInit(hugePages); } # ifdef XMRIG_FEATURE_HWLOC diff --git a/src/crypto/common/VirtualMemory.h b/src/crypto/common/VirtualMemory.h index 3c9839516..1c2e37d20 100644 --- a/src/crypto/common/VirtualMemory.h +++ b/src/crypto/common/VirtualMemory.h @@ -78,7 +78,7 @@ private: FLAG_MAX }; - static void osInit(); + static void osInit(bool hugePages); bool allocateLargePagesMemory(); void freeLargePagesMemory(); diff --git a/src/crypto/common/VirtualMemory_unix.cpp b/src/crypto/common/VirtualMemory_unix.cpp index bb0f9658a..3d099c761 100644 --- a/src/crypto/common/VirtualMemory_unix.cpp +++ b/src/crypto/common/VirtualMemory_unix.cpp @@ -96,7 +96,7 @@ void xmrig::VirtualMemory::unprotectExecutableMemory(void *p, size_t size) } -void xmrig::VirtualMemory::osInit() +void xmrig::VirtualMemory::osInit(bool) { } diff --git a/src/crypto/common/VirtualMemory_win.cpp b/src/crypto/common/VirtualMemory_win.cpp index 875a1e8e7..bfd8de1d6 100644 --- a/src/crypto/common/VirtualMemory_win.cpp +++ b/src/crypto/common/VirtualMemory_win.cpp @@ -201,9 +201,11 @@ void xmrig::VirtualMemory::unprotectExecutableMemory(void *p, size_t size) } -void xmrig::VirtualMemory::osInit() +void xmrig::VirtualMemory::osInit(bool hugePages) { - hugepagesAvailable = TrySetLockPagesPrivilege(); + if (hugePages) { + hugepagesAvailable = TrySetLockPagesPrivilege(); + } }