summaryrefslogtreecommitdiff
path: root/memory.c
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2006-12-19 15:18:14 +0100
committerJens Axboe <jens.axboe@oracle.com>2006-12-19 15:18:14 +0100
commit74b025b071b5bfbffa7ad7682b66b749e8d1f955 (patch)
treec5e1cf0303bf79abec1acd7356e7ca9c986ced0f /memory.c
parent9b031dc82192e884c1d6da9c86f047ecb9ef5c3a (diff)
downloadfio-74b025b071b5bfbffa7ad7682b66b749e8d1f955.tar.gz
fio-74b025b071b5bfbffa7ad7682b66b749e8d1f955.tar.bz2
[PATCH] Support for hugetlb backed shared memory
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'memory.c')
-rw-r--r--memory.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/memory.c b/memory.c
index 39dc250c..a7bf82a8 100644
--- a/memory.c
+++ b/memory.c
@@ -61,8 +61,13 @@ int allocate_io_mem(struct thread_data *td)
{
if (td->mem_type == MEM_MALLOC)
td->orig_buffer = malloc(td->orig_buffer_size);
- else if (td->mem_type == MEM_SHM) {
- td->shm_id = shmget(IPC_PRIVATE, td->orig_buffer_size, IPC_CREAT | 0600);
+ else if (td->mem_type == MEM_SHM || td->mem_type == MEM_SHMHUGE) {
+ int flags = IPC_CREAT | SHM_R | SHM_W;
+
+ if (td->mem_type == MEM_SHMHUGE)
+ flags |= SHM_HUGETLB;
+
+ td->shm_id = shmget(IPC_PRIVATE, td->orig_buffer_size, flags);
if (td->shm_id < 0) {
td_verror(td, errno);
perror("shmget");