1
0
mirror of https://github.com/xmrig/xmrig.git synced 2025-12-06 23:52:38 -05:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Tony Butler
336d6d1d07 Merge 6c8098378a into 36fdfa2694 2025-03-26 09:27:30 +01:00
xmrig
36fdfa2694 Merge pull request #3646 from SChernykh/dev
Optimized autoconfig for AMD CPUs with < 2 MB L3 cache per thread
2025-03-22 18:36:09 +07:00
SChernykh
6cfc02d24f Optimized autoconfig for AMD CPUs with < 2 MB L3 cache per thread 2025-03-22 11:34:23 +01:00
Tony Butler
6c8098378a Add AUTO_HUGEPAGE feature to disable writing to nr_hugepages 2023-07-12 02:06:53 -06:00
3 changed files with 16 additions and 2 deletions

View File

@@ -32,6 +32,7 @@ option(WITH_VAES "Enable VAES instructions for Cryptonight" ON)
option(WITH_BENCHMARK "Enable builtin RandomX benchmark and stress test" ON)
option(WITH_SECURE_JIT "Enable secure access to JIT memory" OFF)
option(WITH_DMI "Enable DMI/SMBIOS reader" ON)
option(WITH_AUTO_HUGEPAGE "Enable Automatic setting of nr_hugepages (Linux Only)" ON)
option(BUILD_STATIC "Build static binary" OFF)
option(ARM_V8 "Force ARMv8 (64 bit) architecture, use with caution if automatic detection fails, but you sure it may work" OFF)
@@ -181,6 +182,10 @@ else()
if (XMRIG_OS_ANDROID)
set(EXTRA_LIBS pthread rt dl log)
elseif (XMRIG_OS_LINUX)
if (WITH_AUTO_HUGEPAGE)
add_definitions(/DXMRIG_FEATURE_AUTO_HUGEPAGE)
endif()
list(APPEND SOURCES_OS
src/crypto/common/LinuxMemory.h
src/crypto/common/LinuxMemory.cpp

View File

@@ -320,8 +320,13 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith
L2 += l2->attr->cache.size;
L2_associativity = l2->attr->cache.associativity;
if (L3_exclusive && l2->attr->cache.size >= scratchpad) {
extra += scratchpad;
if (L3_exclusive) {
if (vendor() == VENDOR_AMD) {
extra += std::min<size_t>(l2->attr->cache.size, scratchpad);
}
else if (l2->attr->cache.size >= scratchpad) {
extra += scratchpad;
}
}
}
}

View File

@@ -60,7 +60,11 @@ bool xmrig::LinuxMemory::reserve(size_t size, uint32_t node, size_t hugePageSize
return false;
}
# ifdef XMRIG_FEATURE_AUTO_HUGEPAGE
return write_nr_hugepages(node, hugePageSize, std::max<size_t>(nr_hugepages(node, hugePageSize), 0) + (required - available));
# else
return false;
# endif
}