X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=memory.c;h=8d6f95579a3366cb633226237965c5de971243e4;hb=a05bd42ddbe73c726d062829c3295e7e315ee653;hp=384b80617f609ca65c6f099b1c073de4c78cc20c;hpb=9b33b4794b621b28347e8ca8fb425b918052434c;p=fio.git diff --git a/memory.c b/memory.c index 384b8061..8d6f9557 100644 --- a/memory.c +++ b/memory.c @@ -70,6 +70,11 @@ int allocate_io_mem(struct thread_data *td) td->shm_id = shmget(IPC_PRIVATE, td->orig_buffer_size, flags); if (td->shm_id < 0) { td_verror(td, errno, "shmget"); + if (geteuid() != 0 && errno == ENOMEM) + log_err("fio: you may need to run this job as root\n"); + if (errno == EINVAL && td->o.mem_type == MEM_SHMHUGE) + log_err("fio: check that you have free huge pages and that hugepage-size is correct.\n"); + return 1; } @@ -93,6 +98,11 @@ int allocate_io_mem(struct thread_data *td) td->orig_buffer = NULL; return 1; } + if (ftruncate(td->mmapfd, td->orig_buffer_size) < 0) { + td_verror(td, errno, "truncate mmap file"); + td->orig_buffer = NULL; + return 1; + } } else flags |= OS_MAP_ANON;