Lines Matching refs:total_mem
64 static int alloc_mem_shm(struct thread_data *td, unsigned int total_mem) in alloc_mem_shm() argument
73 total_mem = (total_mem + mask) & ~mask; in alloc_mem_shm()
76 td->shm_id = shmget(IPC_PRIVATE, total_mem, flags); in alloc_mem_shm()
77 dprint(FD_MEM, "shmget %u, %d\n", total_mem, td->shm_id); in alloc_mem_shm()
125 static int alloc_mem_mmap(struct thread_data *td, size_t total_mem) in alloc_mem_mmap() argument
137 total_mem = (total_mem + mask) & ~mask; in alloc_mem_mmap()
150 ftruncate(td->mmapfd, total_mem) < 0) { in alloc_mem_mmap()
163 td->orig_buffer = mmap(NULL, total_mem, PROT_READ | PROT_WRITE, flags, in alloc_mem_mmap()
165 dprint(FD_MEM, "mmap %llu/%d %p\n", (unsigned long long) total_mem, in alloc_mem_mmap()
182 static void free_mem_mmap(struct thread_data *td, size_t total_mem) in free_mem_mmap() argument
184 dprint(FD_MEM, "munmap %llu %p\n", (unsigned long long) total_mem, in free_mem_mmap()
195 static int alloc_mem_malloc(struct thread_data *td, size_t total_mem) in alloc_mem_malloc() argument
197 td->orig_buffer = malloc(total_mem); in alloc_mem_malloc()
198 dprint(FD_MEM, "malloc %llu %p\n", (unsigned long long) total_mem, in alloc_mem_malloc()
210 static int alloc_mem_cudamalloc(struct thread_data *td, size_t total_mem) in alloc_mem_cudamalloc() argument
256 ret = cuMemAlloc(&td->dev_mem_ptr, total_mem); in alloc_mem_cudamalloc()
258 log_err("fio: cuMemAlloc %zu bytes failed\n", total_mem); in alloc_mem_cudamalloc()
264 (unsigned long long) total_mem, td->orig_buffer); in alloc_mem_cudamalloc()
287 size_t total_mem; in allocate_io_mem() local
293 total_mem = td->orig_buffer_size; in allocate_io_mem()
297 total_mem += page_mask; in allocate_io_mem()
299 total_mem += td->o.mem_align - page_size; in allocate_io_mem()
302 dprint(FD_MEM, "Alloc %llu for buffers\n", (unsigned long long) total_mem); in allocate_io_mem()
313 ret = td->io_ops->iomem_alloc(td, total_mem); in allocate_io_mem()
315 ret = alloc_mem_malloc(td, total_mem); in allocate_io_mem()
317 ret = alloc_mem_shm(td, total_mem); in allocate_io_mem()
320 ret = alloc_mem_mmap(td, total_mem); in allocate_io_mem()
322 ret = alloc_mem_cudamalloc(td, total_mem); in allocate_io_mem()
336 unsigned int total_mem; in free_io_mem() local
338 total_mem = td->orig_buffer_size; in free_io_mem()
340 total_mem += page_mask; in free_io_mem()
351 free_mem_mmap(td, total_mem); in free_io_mem()