From 88effe9a187ee03043af452aad42591d085aff39 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Thu, 1 Dec 2022 13:54:03 -0500 Subject: [PATCH] WIP large pages for randomx --- src/miner.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 2fbe958e7..1da8319f7 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -1068,14 +1068,19 @@ void static RandomXMiner() miningTimer.start(); randomx_flags flags = randomx_get_flags(); - // TODO: attempt to use large pages and fall back to no large pages - // flags |= RANDOMX_FLAG_LARGE_PAGES; + // attempt to use large pages and fall back to no large pages flags |= RANDOMX_FLAG_FULL_MEM; //flags |= RANDOMX_FLAG_JIT; - randomx_cache *randomxCache = randomx_alloc_cache(flags); - if (randomxCache == NULL) { - LogPrintf("RandomX cache is null, something is wrong, cannot mine!\n"); - return; + //flags |= RANDOMX_FLAG_LARGE_PAGES; + randomx_cache *randomxCache = randomx_alloc_cache(flags | RANDOMX_FLAG_LARGE_PAGES); + if (randomxCache == nullptr) { + fprintf(stderr,"%s: unable to allocate with large pages\n", __func__); + LogPrintf("Unable to use randomx large pages, trying without...\n"); + randomx_cache *randomxCache = randomx_alloc_cache(flags); + if (randomxCache == nullptr) { + LogPrintf("Unable to create randomx cache, cannot mine!\n"); + return; + } } rxdebug("%s: created randomx flags + cache\n"); randomx_dataset *randomxDataset = randomx_alloc_dataset(flags);