Skip to content

Commit

Permalink
shm: disable iomem=shm* for shm disabled
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
axboe committed Jan 21, 2015
1 parent ba40757 commit 91e4752
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ int fio_pin_memory(struct thread_data *td)

static int alloc_mem_shm(struct thread_data *td, unsigned int total_mem)
{
#ifndef CONFIG_NO_SHM
int flags = IPC_CREAT | S_IRUSR | S_IWUSR;

if (td->o.mem_type == MEM_SHMHUGE) {
Expand Down Expand Up @@ -104,15 +105,21 @@ static int alloc_mem_shm(struct thread_data *td, unsigned int total_mem)
}

return 0;
#else
log_err("fio: shm not supported\n");
return 1;
#endif
}

static void free_mem_shm(struct thread_data *td)
{
#ifndef CONFIG_NO_SHM
struct shmid_ds sbuf;

dprint(FD_MEM, "shmdt/ctl %d %p\n", td->shm_id, td->orig_buffer);
shmdt(td->orig_buffer);
shmctl(td->shm_id, IPC_RMID, &sbuf);
#endif
}

static int alloc_mem_mmap(struct thread_data *td, size_t total_mem)
Expand Down

0 comments on commit 91e4752

Please sign in to comment.