1
0
mirror of https://github.com/xmrig/xmrig.git synced 2026-06-18 10:22:39 -04:00

RandomX optimizations:

- ARM64: optimized emitMovImmediate/emitMemLoad
- ARM64: disabled 32-bit literal preloading (it was slower)
- Android and Linux: added MADV_COLLAPSE support to memory allocation
This commit is contained in:
SChernykh
2026-05-17 17:35:40 +02:00
parent 27f116e2da
commit 720325c40f
2 changed files with 33 additions and 10 deletions

View File

@@ -74,6 +74,11 @@
#endif
#ifndef MADV_COLLAPSE
# define MADV_COLLAPSE 25
#endif
#if defined(XMRIG_OS_LINUX) || (!defined(XMRIG_OS_APPLE) && !defined(XMRIG_OS_FREEBSD))
static inline int hugePagesFlag(size_t size)
{
@@ -278,8 +283,9 @@ bool xmrig::VirtualMemory::allocateOneGbPagesMemory()
bool xmrig::VirtualMemory::adviseLargePages(void *p, size_t size)
{
# ifdef XMRIG_OS_LINUX
return (madvise(p, size, MADV_HUGEPAGE) == 0);
# if defined(XMRIG_OS_ANDROID) || defined(XMRIG_OS_LINUX)
// MADV_COLLAPSE works even if /sys/kernel/mm/transparent_hugepage/enabled is set to "never", but only on Linux 6.1+
return (madvise(p, size, MADV_COLLAPSE) == 0) || (madvise(p, size, MADV_HUGEPAGE) == 0);
# else
return false;
# endif