Fixed "huge-pages" option.

This commit is contained in:
XMRig 2019-10-21 23:01:30 +07:00
parent 487b2a3655
commit 52281906c6
5 changed files with 11 additions and 9 deletions

View file

@ -23,8 +23,8 @@
*/ */
#include <inttypes.h> #include <cinttypes>
#include <stdio.h> #include <cstdio>
#include <uv.h> #include <uv.h>
@ -59,10 +59,10 @@ inline static const char *asmName(Assembly::Id assembly)
#endif #endif
static void print_memory(Config *) { static void print_memory(Config *config) {
# ifdef _WIN32 # ifdef _WIN32
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") "%s", 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 # endif
} }

View file

@ -112,7 +112,7 @@ void xmrig::VirtualMemory::destroy()
void xmrig::VirtualMemory::init(size_t poolSize, bool hugePages) void xmrig::VirtualMemory::init(size_t poolSize, bool hugePages)
{ {
if (!pool) { if (!pool) {
osInit(); osInit(hugePages);
} }
# ifdef XMRIG_FEATURE_HWLOC # ifdef XMRIG_FEATURE_HWLOC

View file

@ -78,7 +78,7 @@ private:
FLAG_MAX FLAG_MAX
}; };
static void osInit(); static void osInit(bool hugePages);
bool allocateLargePagesMemory(); bool allocateLargePagesMemory();
void freeLargePagesMemory(); void freeLargePagesMemory();

View file

@ -96,7 +96,7 @@ void xmrig::VirtualMemory::unprotectExecutableMemory(void *p, size_t size)
} }
void xmrig::VirtualMemory::osInit() void xmrig::VirtualMemory::osInit(bool)
{ {
} }

View file

@ -201,10 +201,12 @@ void xmrig::VirtualMemory::unprotectExecutableMemory(void *p, size_t size)
} }
void xmrig::VirtualMemory::osInit() void xmrig::VirtualMemory::osInit(bool hugePages)
{ {
if (hugePages) {
hugepagesAvailable = TrySetLockPagesPrivilege(); hugepagesAvailable = TrySetLockPagesPrivilege();
} }
}
bool xmrig::VirtualMemory::allocateLargePagesMemory() bool xmrig::VirtualMemory::allocateLargePagesMemory()