1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 16:53:09 +00:00

Deal with very old linux kernels

MADV_HUGEPAGE might not be available, for kernels before 2.6.38 (released 2011). Just skip the madvise.

closes https://github.com/official-stockfish/Stockfish/pull/3039

No functional change
This commit is contained in:
Joost VandeVondele 2020-08-21 07:42:19 +02:00
parent daac86691d
commit 8b45b1c490

View file

@ -367,7 +367,9 @@ void* aligned_ttmem_alloc(size_t allocSize, void*& mem) {
size_t size = ((allocSize + alignment - 1) / alignment) * alignment; // multiple of alignment
if (posix_memalign(&mem, alignment, size))
mem = nullptr;
#if defined(MADV_HUGEPAGE)
madvise(mem, allocSize, MADV_HUGEPAGE);
#endif
return mem;
}