From 3f894c9bf6f97d13a22db1bf024e4b1ef39f5130 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Tue, 23 Jul 2019 15:26:17 +0000 Subject: [PATCH] No need of an attemps after a failure with a casual mapping. --- src/os.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/os.c b/src/os.c index fa379f94..ee9a91ad 100644 --- a/src/os.c +++ b/src/os.c @@ -293,9 +293,9 @@ static void* mi_unix_mmap(size_t size, size_t try_alignment, int protect_flags) p = mi_unix_mmapx(size, try_alignment, protect_flags, lflags, fd); #ifdef MADV_HUGEPAGE if (p == MAP_FAILED) { - lflags &= MAP_HUGETLB; // large page could be set to madvise only + lflags = flags; // large page could be set to madvise only p = mi_unix_mmapx(size, try_alignment, protect_flags, lflags, fd); - if (p == MAP_FAILED) p = NULL; // we did what we could at this stage + if (p == MAP_FAILED) return NULL; // we did what we could at this stage else madvise(p, size, MADV_HUGEPAGE); } #else