Added VirtualMemory::bindToNUMANode

This commit is contained in:
XMRig 2019-07-26 15:29:06 +07:00
parent a5e8b31d55
commit ffa6bda106
7 changed files with 98 additions and 5 deletions

View file

@ -38,6 +38,9 @@
namespace xmrig {
uint32_t HwlocCpuInfo::m_features = 0;
static inline bool isCacheObject(hwloc_obj_t obj)
{
# if HWLOC_API_VERSION >= 0x20000
@ -147,6 +150,10 @@ xmrig::HwlocCpuInfo::HwlocCpuInfo() : BasicCpuInfo(),
m_cores = countByType(m_topology, HWLOC_OBJ_CORE);
m_nodes = std::max<size_t>(countByType(m_topology, HWLOC_OBJ_NUMANODE), 1);
m_packages = countByType(m_topology, HWLOC_OBJ_PACKAGE);
if (nodes() > 1 && hwloc_topology_get_support(m_topology)->membind->set_thisthread_membind) {
m_features |= SET_THISTHREAD_MEMBIND;
}
}

View file

@ -39,9 +39,16 @@ namespace xmrig {
class HwlocCpuInfo : public BasicCpuInfo
{
public:
enum Feature : uint32_t {
SET_THISTHREAD_MEMBIND = 1
};
HwlocCpuInfo();
~HwlocCpuInfo() override;
static inline bool has(Feature feature) { return m_features & feature; }
protected:
CpuThreads threads(const Algorithm &algorithm) const override;
@ -55,6 +62,8 @@ protected:
private:
void processTopLevelCache(hwloc_obj_t obj, const Algorithm &algorithm, CpuThreads &threads) const;
static uint32_t m_features;
char m_backend[20];
hwloc_topology_t m_topology;
size_t m_cache[5];