From: Jens Axboe Date: Tue, 20 Mar 2007 09:33:11 +0000 (+0100) Subject: Always make sure buffer sizes are aligned for allocation X-Git-Tag: fio-1.15~68 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=4afbf66fd5fb867217e4cc6b8259fd97ba0d0e8d Always make sure buffer sizes are aligned for allocation Signed-off-by: Jens Axboe --- diff --git a/fio.c b/fio.c index a4168564..3c01156d 100644 --- a/fio.c +++ b/fio.c @@ -603,8 +603,8 @@ static int init_io_u(struct thread_data *td) if (td->o.mem_type == MEM_SHMHUGE || td->o.mem_type == MEM_MMAPHUGE) td->orig_buffer_size = (td->orig_buffer_size + td->o.hugepage_size - 1) & ~(td->o.hugepage_size - 1); - else - td->orig_buffer_size += page_mask; + else if (td->orig_buffer_size & page_mask) + td->orig_buffer_size = (td->orig_buffer_size + page_mask) & ~page_mask; if (allocate_io_mem(td)) return 1;