From aa2985490c0c9d249b82958e6246faaa1477dffc Mon Sep 17 00:00:00 2001 From: yah01 Date: Thu, 20 Apr 2023 12:36:30 +0800 Subject: [PATCH] Retrieve page size by getpagesize() (#23561) Signed-off-by: yah01 --- internal/core/src/common/Utils.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/core/src/common/Utils.h b/internal/core/src/common/Utils.h index 6353af0d10..8f3ae1068d 100644 --- a/internal/core/src/common/Utils.h +++ b/internal/core/src/common/Utils.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -420,10 +421,10 @@ CreateMap(int64_t segment_id, #ifndef MAP_POPULATE // Manually access the mapping to populate it - const size_t PAGE_SIZE = 4 << 10; // 4KiB + const size_t page_size = getpagesize(); char* begin = (char*)map; char* end = begin + written; - for (char* page = begin; page < end; page += PAGE_SIZE) { + for (char* page = begin; page < end; page += page_size) { char value = page[0]; } #endif