From a62c145f2614203dfadd5bcc5f601d6e9c899c2d Mon Sep 17 00:00:00 2001 From: Marco Previtali Date: Mon, 11 Nov 2019 12:10:30 +0100 Subject: [PATCH] Adds guards for hugepages --- bloomfilter.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bloomfilter.h b/bloomfilter.h index 5534928..ea09a31 100644 --- a/bloomfilter.h +++ b/bloomfilter.h @@ -63,11 +63,13 @@ class BF { _mode(0), _bf(size, 0) { +#ifdef MADV_HUGEPAGE char* const sptr = reinterpret_cast(_bf.data()); const size_t soffset = SHARK_HUGEPAGESIZE - (reinterpret_cast(sptr) % SHARK_HUGEPAGESIZE); char* const eptr = sptr + (((size + 63) >> 6) << 3); const size_t eoffset = (reinterpret_cast(eptr) % SHARK_HUGEPAGESIZE); madvise(sptr + soffset, (eptr - sptr) - eoffset - soffset, MADV_HUGEPAGE); +#endif } ~BF() {}