mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-18 00:37:46 +00:00
Return correct hugePages count if NUMA mode used.
This commit is contained in:
parent
828fc065b0
commit
9df9275120
4 changed files with 27 additions and 9 deletions
|
@ -295,12 +295,9 @@ rapidjson::Value xmrig::CpuBackend::toJSON(rapidjson::Document &doc) const
|
|||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
if (d_ptr->algo.family() == Algorithm::RANDOM_X) {
|
||||
RxDataset *dataset = Rx::dataset(0); // FIXME
|
||||
if (dataset) {
|
||||
const auto rxPages = dataset->hugePages();
|
||||
pages[0] += rxPages.first;
|
||||
pages[1] += rxPages.second;
|
||||
}
|
||||
const auto rxPages = Rx::hugePages();
|
||||
pages[0] += rxPages.first;
|
||||
pages[1] += rxPages.second;
|
||||
}
|
||||
# endif
|
||||
|
||||
|
|
|
@ -146,7 +146,6 @@ static RxPrivate *d_ptr = new RxPrivate();
|
|||
} // namespace xmrig
|
||||
|
||||
|
||||
|
||||
bool xmrig::Rx::isReady(const Job &job, uint32_t nodeId)
|
||||
{
|
||||
d_ptr->lock();
|
||||
|
@ -157,7 +156,6 @@ bool xmrig::Rx::isReady(const Job &job, uint32_t nodeId)
|
|||
}
|
||||
|
||||
|
||||
|
||||
xmrig::RxDataset *xmrig::Rx::dataset(uint32_t nodeId)
|
||||
{
|
||||
d_ptr->lock();
|
||||
|
@ -168,6 +166,27 @@ xmrig::RxDataset *xmrig::Rx::dataset(uint32_t nodeId)
|
|||
}
|
||||
|
||||
|
||||
std::pair<size_t, size_t> xmrig::Rx::hugePages()
|
||||
{
|
||||
std::pair<size_t, size_t> pages(0, 0);
|
||||
d_ptr->lock();
|
||||
|
||||
for (auto const &item : d_ptr->datasets) {
|
||||
if (!item.second) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto p = item.second->hugePages();
|
||||
pages.first += p.first;
|
||||
pages.second += p.second;
|
||||
}
|
||||
|
||||
d_ptr->unlock();
|
||||
|
||||
return pages;
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Rx::init(const Job &job, int initThreads, bool hugePages, bool numa)
|
||||
{
|
||||
if (job.algorithm().family() != Algorithm::RANDOM_X) {
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <utility>
|
||||
|
||||
|
||||
namespace xmrig
|
||||
|
@ -45,6 +46,7 @@ class Rx
|
|||
public:
|
||||
static bool isReady(const Job &job, uint32_t nodeId);
|
||||
static RxDataset *dataset(uint32_t nodeId);
|
||||
static std::pair<size_t, size_t> hugePages();
|
||||
static void init(const Job &job, int initThreads, bool hugePages, bool numa);
|
||||
static void stop();
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ bool xmrig::RxDataset::isReady(const void *seed, const Algorithm &algorithm) con
|
|||
|
||||
std::pair<size_t, size_t> xmrig::RxDataset::hugePages() const
|
||||
{
|
||||
constexpr size_t twoMiB = 2u * 1024u * 1024u;
|
||||
constexpr size_t twoMiB = 2u * 1024u * 1024u;
|
||||
constexpr const size_t total = (VirtualMemory::align(size(), twoMiB) + VirtualMemory::align(RxCache::size(), twoMiB)) / twoMiB;
|
||||
|
||||
size_t count = 0;
|
||||
|
|
Loading…
Reference in a new issue