mirror of
https://github.com/xmrig/xmrig.git
synced 2024-12-23 03:59:41 +00:00
Use node number instead of affinity
This commit is contained in:
parent
6ae37a9519
commit
69cbfd682a
6 changed files with 9 additions and 10 deletions
|
@ -118,7 +118,7 @@ void xmrig::CpuWorker<N>::allocateRandomX_VM()
|
|||
}
|
||||
|
||||
if (!m_vm) {
|
||||
m_vm = new RxVm(dataset, m_memory->scratchpad(), !m_hwAES, m_assembly, m_affinity);
|
||||
m_vm = new RxVm(dataset, m_memory->scratchpad(), !m_hwAES, m_assembly, m_node);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -399,25 +399,24 @@ extern "C" {
|
|||
delete dataset;
|
||||
}
|
||||
|
||||
randomx_vm* randomx_create_vm(randomx_flags flags, randomx_cache* cache, randomx_dataset* dataset, uint8_t* scratchpad, int64_t affinity) {
|
||||
randomx_vm* randomx_create_vm(randomx_flags flags, randomx_cache* cache, randomx_dataset* dataset, uint8_t* scratchpad, uint32_t node) {
|
||||
assert(cache != nullptr || (flags & RANDOMX_FLAG_FULL_MEM));
|
||||
assert(cache == nullptr || cache->isInitialized());
|
||||
assert(dataset != nullptr || !(flags & RANDOMX_FLAG_FULL_MEM));
|
||||
|
||||
randomx_vm* vm = nullptr;
|
||||
|
||||
std::lock_guard<std::mutex> lock(vm_pool_mutex);
|
||||
|
||||
static uint8_t* vm_pool[64] = {};
|
||||
static size_t vm_pool_offset[64] = {};
|
||||
|
||||
constexpr size_t VM_POOL_SIZE = 2 * 1024 * 1024;
|
||||
|
||||
uint32_t node = xmrig::VirtualMemory::bindToNUMANode(affinity);
|
||||
if (node > 64) {
|
||||
node = 0;
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lock(vm_pool_mutex);
|
||||
|
||||
if (!vm_pool[node]) {
|
||||
vm_pool[node] = (uint8_t*) xmrig::VirtualMemory::allocateLargePagesMemory(VM_POOL_SIZE);
|
||||
if (!vm_pool[node]) {
|
||||
|
|
|
@ -308,7 +308,7 @@ RANDOMX_EXPORT void randomx_release_dataset(randomx_dataset *dataset);
|
|||
* (3) cache parameter is NULL and RANDOMX_FLAG_FULL_MEM is not set
|
||||
* (4) dataset parameter is NULL and RANDOMX_FLAG_FULL_MEM is set
|
||||
*/
|
||||
RANDOMX_EXPORT randomx_vm *randomx_create_vm(randomx_flags flags, randomx_cache *cache, randomx_dataset *dataset, uint8_t *scratchpad, int64_t affinity);
|
||||
RANDOMX_EXPORT randomx_vm *randomx_create_vm(randomx_flags flags, randomx_cache *cache, randomx_dataset *dataset, uint8_t *scratchpad, uint32_t node);
|
||||
|
||||
/**
|
||||
* Reinitializes a virtual machine with a new Cache. This function should be called anytime
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "crypto/rx/RxVm.h"
|
||||
|
||||
|
||||
xmrig::RxVm::RxVm(RxDataset *dataset, uint8_t *scratchpad, bool softAes, xmrig::Assembly assembly, int64_t affinity)
|
||||
xmrig::RxVm::RxVm(RxDataset *dataset, uint8_t *scratchpad, bool softAes, xmrig::Assembly assembly, uint32_t node)
|
||||
{
|
||||
if (!softAes) {
|
||||
m_flags |= RANDOMX_FLAG_HARD_AES;
|
||||
|
@ -53,7 +53,7 @@ xmrig::RxVm::RxVm(RxDataset *dataset, uint8_t *scratchpad, bool softAes, xmrig::
|
|||
m_flags |= RANDOMX_FLAG_AMD;
|
||||
}
|
||||
|
||||
m_vm = randomx_create_vm(static_cast<randomx_flags>(m_flags), dataset->cache() ? dataset->cache()->get() : nullptr, dataset->get(), scratchpad, affinity);
|
||||
m_vm = randomx_create_vm(static_cast<randomx_flags>(m_flags), dataset->cache() ? dataset->cache()->get() : nullptr, dataset->get(), scratchpad, node);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ class RxVm
|
|||
public:
|
||||
XMRIG_DISABLE_COPY_MOVE_DEFAULT(RxVm);
|
||||
|
||||
RxVm(RxDataset *dataset, uint8_t *scratchpad, bool softAes, xmrig::Assembly assembly, int64_t affinity);
|
||||
RxVm(RxDataset *dataset, uint8_t *scratchpad, bool softAes, xmrig::Assembly assembly, uint32_t node);
|
||||
~RxVm();
|
||||
|
||||
inline randomx_vm *get() const { return m_vm; }
|
||||
|
|
|
@ -116,7 +116,7 @@ static void getResults(JobBundle &bundle, std::vector<JobResult> &results, uint3
|
|||
return;
|
||||
}
|
||||
|
||||
auto vm = new RxVm(dataset, memory->scratchpad(), !hwAES, Assembly::NONE, -1);
|
||||
auto vm = new RxVm(dataset, memory->scratchpad(), !hwAES, Assembly::NONE, 0);
|
||||
|
||||
for (uint32_t nonce : bundle.nonces) {
|
||||
*bundle.job.nonce() = nonce;
|
||||
|
|
Loading…
Reference in a new issue