Honor LARGE_PAGES flag in randomx umask
This commit is contained in:
parent
cb70ae9450
commit
86263b386c
|
@ -264,12 +264,14 @@ void rx_slow_hash(const uint64_t mainheight, const uint64_t seedheight, const ch
|
||||||
|
|
||||||
cache = rx_sp->rs_cache;
|
cache = rx_sp->rs_cache;
|
||||||
if (cache == NULL) {
|
if (cache == NULL) {
|
||||||
if (cache == NULL) {
|
if (!(disabled_flags() & RANDOMX_FLAG_LARGE_PAGES)) {
|
||||||
cache = randomx_alloc_cache(flags | RANDOMX_FLAG_LARGE_PAGES);
|
cache = randomx_alloc_cache(flags | RANDOMX_FLAG_LARGE_PAGES);
|
||||||
if (cache == NULL) {
|
if (cache == NULL) {
|
||||||
mdebug(RX_LOGCAT, "Couldn't use largePages for RandomX cache");
|
mdebug(RX_LOGCAT, "Couldn't use largePages for RandomX cache");
|
||||||
cache = randomx_alloc_cache(flags);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (cache == NULL) {
|
||||||
|
cache = randomx_alloc_cache(flags);
|
||||||
if (cache == NULL)
|
if (cache == NULL)
|
||||||
local_abort("Couldn't allocate RandomX cache");
|
local_abort("Couldn't allocate RandomX cache");
|
||||||
}
|
}
|
||||||
|
@ -291,11 +293,14 @@ void rx_slow_hash(const uint64_t mainheight, const uint64_t seedheight, const ch
|
||||||
CTHR_MUTEX_LOCK(rx_dataset_mutex);
|
CTHR_MUTEX_LOCK(rx_dataset_mutex);
|
||||||
if (!rx_dataset_nomem) {
|
if (!rx_dataset_nomem) {
|
||||||
if (rx_dataset == NULL) {
|
if (rx_dataset == NULL) {
|
||||||
rx_dataset = randomx_alloc_dataset(RANDOMX_FLAG_LARGE_PAGES);
|
if (!(disabled_flags() & RANDOMX_FLAG_LARGE_PAGES)) {
|
||||||
if (rx_dataset == NULL) {
|
rx_dataset = randomx_alloc_dataset(RANDOMX_FLAG_LARGE_PAGES);
|
||||||
mdebug(RX_LOGCAT, "Couldn't use largePages for RandomX dataset");
|
if (rx_dataset == NULL) {
|
||||||
rx_dataset = randomx_alloc_dataset(RANDOMX_FLAG_DEFAULT);
|
mdebug(RX_LOGCAT, "Couldn't use largePages for RandomX dataset");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (rx_dataset == NULL)
|
||||||
|
rx_dataset = randomx_alloc_dataset(RANDOMX_FLAG_DEFAULT);
|
||||||
if (rx_dataset != NULL)
|
if (rx_dataset != NULL)
|
||||||
rx_initdata(rx_sp->rs_cache, miners, seedheight);
|
rx_initdata(rx_sp->rs_cache, miners, seedheight);
|
||||||
}
|
}
|
||||||
|
@ -311,11 +316,14 @@ void rx_slow_hash(const uint64_t mainheight, const uint64_t seedheight, const ch
|
||||||
}
|
}
|
||||||
CTHR_MUTEX_UNLOCK(rx_dataset_mutex);
|
CTHR_MUTEX_UNLOCK(rx_dataset_mutex);
|
||||||
}
|
}
|
||||||
rx_vm = randomx_create_vm(flags | RANDOMX_FLAG_LARGE_PAGES, rx_sp->rs_cache, rx_dataset);
|
if (!(disabled_flags() & RANDOMX_FLAG_LARGE_PAGES)) {
|
||||||
if(rx_vm == NULL) { //large pages failed
|
rx_vm = randomx_create_vm(flags | RANDOMX_FLAG_LARGE_PAGES, rx_sp->rs_cache, rx_dataset);
|
||||||
mdebug(RX_LOGCAT, "Couldn't use largePages for RandomX VM");
|
if(rx_vm == NULL) { //large pages failed
|
||||||
rx_vm = randomx_create_vm(flags, rx_sp->rs_cache, rx_dataset);
|
mdebug(RX_LOGCAT, "Couldn't use largePages for RandomX VM");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (rx_vm == NULL)
|
||||||
|
rx_vm = randomx_create_vm(flags, rx_sp->rs_cache, rx_dataset);
|
||||||
if(rx_vm == NULL) {//fallback if everything fails
|
if(rx_vm == NULL) {//fallback if everything fails
|
||||||
flags = RANDOMX_FLAG_DEFAULT | (miners ? RANDOMX_FLAG_FULL_MEM : 0);
|
flags = RANDOMX_FLAG_DEFAULT | (miners ? RANDOMX_FLAG_FULL_MEM : 0);
|
||||||
rx_vm = randomx_create_vm(flags, rx_sp->rs_cache, rx_dataset);
|
rx_vm = randomx_create_vm(flags, rx_sp->rs_cache, rx_dataset);
|
||||||
|
|
Loading…
Reference in New Issue