aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSChernykh <sergey.v.chernykh@gmail.com>2023-01-11 19:15:11 +0100
committerSChernykh <sergey.v.chernykh@gmail.com>2023-01-11 19:15:11 +0100
commitb27a17110da15a2da8eb7f63e09a5bc24e00d86a (patch)
treebd95ad71d5654d4bdaf92e0a26f9e0fe3bacbdf8 /src
parentMerge pull request #8675 (diff)
downloadmonero-b27a17110da15a2da8eb7f63e09a5bc24e00d86a.tar.xz
RandomX: print VM allocation warnings only once
Diffstat (limited to 'src')
-rw-r--r--src/crypto/rx-slow-hash.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/crypto/rx-slow-hash.c b/src/crypto/rx-slow-hash.c
index 8682daeb2..8ad700fd8 100644
--- a/src/crypto/rx-slow-hash.c
+++ b/src/crypto/rx-slow-hash.c
@@ -246,7 +246,11 @@ static void rx_init_full_vm(randomx_flags flags, randomx_vm** vm)
*vm = randomx_create_vm((flags | RANDOMX_FLAG_LARGE_PAGES | RANDOMX_FLAG_FULL_MEM) & ~disabled_flags(), NULL, main_dataset);
if (!*vm) {
- mwarning(RX_LOGCAT, "Couldn't allocate RandomX full VM using large pages");
+ static int shown = 0;
+ if (!shown) {
+ shown = 1;
+ mwarning(RX_LOGCAT, "Couldn't allocate RandomX full VM using large pages (will print only once)");
+ }
*vm = randomx_create_vm((flags | RANDOMX_FLAG_FULL_MEM) & ~disabled_flags(), NULL, main_dataset);
if (!*vm) {
merror(RX_LOGCAT, "Couldn't allocate RandomX full VM");
@@ -269,7 +273,11 @@ static void rx_init_light_vm(randomx_flags flags, randomx_vm** vm, randomx_cache
*vm = randomx_create_vm((flags | RANDOMX_FLAG_LARGE_PAGES) & ~disabled_flags(), cache, NULL);
if (!*vm) {
- mwarning(RX_LOGCAT, "Couldn't allocate RandomX light VM using large pages");
+ static int shown = 0;
+ if (!shown) {
+ shown = 1;
+ mwarning(RX_LOGCAT, "Couldn't allocate RandomX light VM using large pages (will print only once)");
+ }
*vm = randomx_create_vm(flags & ~disabled_flags(), cache, NULL);
if (!*vm) local_abort("Couldn't allocate RandomX light VM");
}