X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=memory.c;h=5678350f79b2527e50f7f58bd0542fdab9e8e993;hp=f67dd6d9ffa09a61030fed8378f8ce9d2a523d15;hb=64d04e4ee255be69b491907cdba183e6b09e9164;hpb=b6f9676ef7077c9c6d60a9f63c3c1e3d44a625a1 diff --git a/memory.c b/memory.c index f67dd6d9..5678350f 100644 --- a/memory.c +++ b/memory.c @@ -65,8 +65,14 @@ static int alloc_mem_shm(struct thread_data *td) 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"); + if (td->o.mem_type == MEM_SHMHUGE) { + if (errno == EINVAL) + log_err("fio: check that you have free huge pages and that hugepage-size is correct.\n"); + else if (errno == ENOSYS) + log_err("fio: your system does not appear to support huge pages.\n"); + else if (errno == ENOMEM) + log_err("fio: no huge pages available, do you need to alocate some? See HOWTO.\n"); + } return 1; } @@ -120,7 +126,12 @@ static int alloc_mem_mmap(struct thread_data *td) static int alloc_mem_malloc(struct thread_data *td) { - td->orig_buffer = malloc(td->orig_buffer_size); + unsigned int bsize = td->orig_buffer_size; + + if (td->o.odirect) + bsize += page_mask; + + td->orig_buffer = malloc(bsize); if (td->orig_buffer) return 0; @@ -134,6 +145,9 @@ int allocate_io_mem(struct thread_data *td) { int ret = 0; + if (td->io_ops->flags & FIO_NOIO) + return 0; + if (td->o.mem_type == MEM_MALLOC) ret = alloc_mem_malloc(td); else if (td->o.mem_type == MEM_SHM || td->o.mem_type == MEM_SHMHUGE) @@ -145,6 +159,9 @@ int allocate_io_mem(struct thread_data *td) ret = 1; } + if (ret) + td_verror(td, ENOMEM, "iomem allocation"); + return ret; }