|
@@ -19,6 +19,10 @@
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
|
|
+#ifdef PAGESIZE_ALIGN
|
|
|
+#include <unistd.h> /* for pagesize */
|
|
|
+#endif /* PAGESIZE_ALIGN */
|
|
|
+
|
|
|
#include "request_memory.h"
|
|
|
#ifdef FL_RB_ONLY
|
|
|
#include "dmmlib/freelist/freelist_rb.h"
|
|
@@ -39,6 +43,13 @@ raw_block_header_t *create_raw_block(size_t raw_block_size, rb_type type) {
|
|
|
size_t remaining_cells;
|
|
|
#endif /* BITMAP_RB_ONLY */
|
|
|
|
|
|
+ // In case mmap() function is used, align the requested size to multiple of
|
|
|
+ // pagesizes
|
|
|
+#ifdef PAGESIZE_ALIGN
|
|
|
+ size_t pagesize = (size_t) sysconf(_SC_PAGESIZE);
|
|
|
+ raw_block_size = pagesize * ((raw_block_size + pagesize - 1) / pagesize);
|
|
|
+#endif /* PAGESIZE_ALIGN */
|
|
|
+
|
|
|
ptr = (raw_block_header_t *)request_memory(raw_block_size);
|
|
|
|
|
|
if(ptr == NULL) {
|