summaryrefslogtreecommitdiff
path: root/memory.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2012-12-03 14:37:23 +0100
committerJens Axboe <axboe@kernel.dk>2012-12-03 14:37:23 +0100
commit49758e11f3658686ccd1c61724a5eba142f3ee4f (patch)
treecc63995cb48b85873f7798230fa856988cdaaeb1 /memory.c
parent7956f141c058cdd95f14491ee646b7f7951ab2ab (diff)
parenta7f5831f1feafbaa41a558028226b517734c54a0 (diff)
Merge branch 'master' into gfio
Conflicts: Makefile fio.h io_u.c ioengine.h memory.c Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'memory.c')
-rw-r--r--memory.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/memory.c b/memory.c
index f97749b..5293af9 100644
--- a/memory.c
+++ b/memory.c
@@ -5,7 +5,9 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
+#ifndef FIO_NO_HAVE_SHM_H
#include <sys/shm.h>
+#endif
#include <sys/mman.h>
#include "fio.h"
@@ -119,6 +121,13 @@ static int alloc_mem_mmap(struct thread_data *td, size_t total_mem)
td->mmapfd = 1;
+ if (td->o.mem_type == MEM_MMAPHUGE) {
+ unsigned long mask = td->o.hugepage_size - 1;
+
+ flags |= MAP_HUGETLB;
+ total_mem = (total_mem + mask) & ~mask;
+ }
+
if (td->o.mmapfile) {
td->mmapfd = open(td->o.mmapfile, O_RDWR|O_CREAT, 0644);