[PATCH] Support for hugetlb backed shared memory
[fio.git] / fio.c
diff --git a/fio.c b/fio.c
index 3ffe1e17a601eebc54debbb1f51580a969b56bc1..87136141b0e34770851dbab53a942d9774eb6f48 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -507,7 +507,12 @@ static int init_io_u(struct thread_data *td)
                max_units = td->iodepth;
 
        max_bs = max(td->max_bs[DDIR_READ], td->max_bs[DDIR_WRITE]);
-       td->orig_buffer_size = max_bs * max_units + MASK;
+       td->orig_buffer_size = max_bs * max_units;
+
+       if (td->mem_type == MEM_SHMHUGE)
+               td->orig_buffer_size = (td->orig_buffer_size + FIO_HUGE_PAGE - 1) & ~FIO_HUGE_PAGE;
+       else
+               td->orig_buffer_size += MASK;
 
        if (allocate_io_mem(td))
                return 1;