Added support for allocate RandomX dataset on each NUMA node.
This commit is contained in:
parent
e53ae0c15e
commit
828fc065b0
11 changed files with 178 additions and 70 deletions
|
@ -35,11 +35,11 @@
|
|||
#include "crypto/common/VirtualMemory.h"
|
||||
|
||||
|
||||
void xmrig::VirtualMemory::bindToNUMANode(int64_t affinity)
|
||||
uint32_t xmrig::VirtualMemory::bindToNUMANode(int64_t affinity)
|
||||
{
|
||||
# ifdef XMRIG_FEATURE_HWLOC
|
||||
if (affinity < 0 || !HwlocCpuInfo::has(HwlocCpuInfo::SET_THISTHREAD_MEMBIND)) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
hwloc_topology_t topology;
|
||||
|
@ -53,6 +53,21 @@ void xmrig::VirtualMemory::bindToNUMANode(int64_t affinity)
|
|||
LOG_WARN("CPU #%02u warning: \"can't bind memory\"", puId);
|
||||
}
|
||||
|
||||
hwloc_obj_t node = nullptr;
|
||||
uint32_t nodeId = 0;
|
||||
|
||||
while ((node = hwloc_get_next_obj_by_type(topology, HWLOC_OBJ_NUMANODE, node)) != nullptr) {
|
||||
if (hwloc_bitmap_intersects(node->cpuset, pu->cpuset)) {
|
||||
nodeId = node->os_index;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
hwloc_topology_destroy(topology);
|
||||
|
||||
return nodeId;
|
||||
# else
|
||||
return 0;
|
||||
# endif
|
||||
}
|
||||
|
|
|
@ -52,9 +52,9 @@ public:
|
|||
return std::pair<size_t, size_t>(isHugePages() ? (align(size()) / 2097152) : 0, align(size()) / 2097152);
|
||||
}
|
||||
|
||||
static uint32_t bindToNUMANode(int64_t affinity);
|
||||
static void *allocateExecutableMemory(size_t size);
|
||||
static void *allocateLargePagesMemory(size_t size);
|
||||
static void bindToNUMANode(int64_t affinity);
|
||||
static void flushInstructionCache(void *p, size_t size);
|
||||
static void freeLargePagesMemory(void *p, size_t size);
|
||||
static void init(bool hugePages);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue