Added option --no-huge-pages.

This commit is contained in:
XMRig 2017-08-16 14:21:12 +03:00
parent 27f02d5f9f
commit 8bba0df054
6 changed files with 28 additions and 5 deletions

View file

@ -144,7 +144,7 @@ static BOOL TrySetLockPagesPrivilege() {
}
bool Mem::allocate(int algo, int threads, bool doubleHash)
bool Mem::allocate(int algo, int threads, bool doubleHash, bool enabled)
{
m_algo = algo;
m_threads = threads;
@ -153,6 +153,11 @@ bool Mem::allocate(int algo, int threads, bool doubleHash)
const int ratio = (doubleHash && algo != Options::ALGO_CRYPTONIGHT_LITE) ? 2 : 1;
const size_t size = MEMORY * (threads * ratio + 1);
if (!enabled) {
m_memory = static_cast<uint8_t*>(_mm_malloc(size, 16));
return true;
}
if (TrySetLockPagesPrivilege()) {
m_flags |= HugepagesAvailable;
}