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 <stdio.h>
#include <cinttypes>
#include <cstdio>
#include <uv.h>
@ -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
}

View file

@ -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

View file

@ -78,7 +78,7 @@ private:
FLAG_MAX
};
static void osInit();
static void osInit(bool hugePages);
bool allocateLargePagesMemory();
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,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();
}
}