From 20e7d62ec7fd7ffb1d13e667f0e2071ac58530c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ben=20Gr=C3=A4f?= Date: Mon, 11 Feb 2019 12:11:59 +0100 Subject: [PATCH] Fixed for hugepages on cn-turtle --- src/Mem.cpp | 1 - src/Mem_win.cpp | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Mem.cpp b/src/Mem.cpp index 36551711..a9a233b4 100644 --- a/src/Mem.cpp +++ b/src/Mem.cpp @@ -62,7 +62,6 @@ ScratchPadMem Mem::create(ScratchPad** scratchPads, int threadId) ScratchPadMem scratchPadMem; scratchPadMem.realSize = scratchPadSize * getThreadHashFactor(threadId); scratchPadMem.size = scratchPadSize * getThreadHashFactor(threadId); - scratchPadMem.size += scratchPadMem.size % MEMORY; scratchPadMem.pages = std::max(scratchPadMem.size / MEMORY, static_cast(1)); allocate(scratchPadMem, m_useHugePages); diff --git a/src/Mem_win.cpp b/src/Mem_win.cpp index b7a318d6..1a8e582d 100644 --- a/src/Mem_win.cpp +++ b/src/Mem_win.cpp @@ -21,7 +21,7 @@ * along with this program. If not, see . */ - +#include #include #include #include @@ -159,6 +159,8 @@ void Mem::allocate(ScratchPadMem& scratchPadMem, bool useHugePages) return; } + scratchPadMem.size = std::max(scratchPadMem.size, static_cast(MEMORY)); + scratchPadMem.memory = static_cast(VirtualAlloc(nullptr, scratchPadMem.size, MEM_COMMIT | MEM_RESERVE | MEM_LARGE_PAGES, PAGE_READWRITE)); if (scratchPadMem.memory) { scratchPadMem.hugePages = scratchPadMem.pages;