Added 1GB hugepages support for Linux

This commit is contained in:
SChernykh 2019-12-05 19:39:47 +01:00
parent caa2da8bb3
commit 1fbbae1e4a
28 changed files with 156 additions and 50 deletions

View file

@ -45,6 +45,10 @@
# define bit_AVX2 (1 << 5)
#endif
#ifndef bit_PDPE1GB
# define bit_PDPE1GB (1 << 26)
#endif
#include "backend/cpu/platform/BasicCpuInfo.h"
#include "crypto/common/Assembly.h"
@ -53,6 +57,7 @@
#define VENDOR_ID (0)
#define PROCESSOR_INFO (1)
#define EXTENDED_FEATURES (7)
#define PROCESSOR_EXT_INFO (0x80000001)
#define PROCESSOR_BRAND_STRING_1 (0x80000002)
#define PROCESSOR_BRAND_STRING_2 (0x80000003)
#define PROCESSOR_BRAND_STRING_3 (0x80000004)
@ -136,6 +141,12 @@ static inline bool has_avx2()
}
static inline bool has_pdpe1gb()
{
return has_feature(PROCESSOR_EXT_INFO, EDX_Reg, bit_PDPE1GB);
}
} // namespace xmrig
@ -144,7 +155,8 @@ xmrig::BasicCpuInfo::BasicCpuInfo() :
m_threads(std::thread::hardware_concurrency()),
m_assembly(Assembly::NONE),
m_aes(has_aes_ni()),
m_avx2(has_avx2())
m_avx2(has_avx2()),
m_pdpe1gb(has_pdpe1gb())
{
cpu_brand_string(m_brand);

View file

@ -44,6 +44,7 @@ protected:
inline Assembly::Id assembly() const override { return m_assembly; }
inline bool hasAES() const override { return m_aes; }
inline bool hasAVX2() const override { return m_avx2; }
inline bool hasOneGbPages() const override { return m_pdpe1gb; }
inline const char *brand() const override { return m_brand; }
inline size_t cores() const override { return 0; }
inline size_t L2() const override { return 0; }
@ -60,6 +61,7 @@ private:
Assembly m_assembly;
bool m_aes;
const bool m_avx2;
const bool m_pdpe1gb;
};