From 56bb17f297c50b2832c845b0f6cdde5063748b34 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 20 Dec 2006 20:27:36 +0100 Subject: [PATCH] [PATCH] Add hugepage-size option We default to 4MiB, but export the setting so it can be changed. Signed-off-by: Jens Axboe --- HOWTO | 6 +++++- fio.c | 2 +- fio.h | 1 + init.c | 7 +++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/HOWTO b/HOWTO index 996da23a..3b270b1d 100644 --- a/HOWTO +++ b/HOWTO @@ -378,12 +378,16 @@ mem=str Fio can use various types of memory as the io unit buffer. divide that number by the huge page size. You can see the size of the huge pages in /proc/meminfo. If no huge pages are allocated by having a non-zero number in nr_hugepages, - using mmaphuge or shmhuge will fail. + using mmaphuge or shmhuge will fail. Also see hugepage-size. mmaphuge also needs to have hugetlbfs mounted and the file location should point there. So if it's mounted in /huge, you would use mem=mmaphuge:/huge/somefile. +hugepage-size=siint + Defines the size of a huge page. Must at least be equal + to the system setting, see /proc/meminfo. Defaults to 4MiB. + exitall When one job finishes, terminate the rest. The default is to wait for each job to finish, sometimes that is not the desired action. diff --git a/fio.c b/fio.c index 8a4a44dc..f046b0cd 100644 --- a/fio.c +++ b/fio.c @@ -510,7 +510,7 @@ static int init_io_u(struct thread_data *td) td->orig_buffer_size = max_bs * max_units; if (td->mem_type == MEM_SHMHUGE || td->mem_type == MEM_MMAPHUGE) - td->orig_buffer_size = (td->orig_buffer_size + FIO_HUGE_PAGE - 1) & ~(FIO_HUGE_PAGE - 1); + td->orig_buffer_size = (td->orig_buffer_size + td->hugepage_size - 1) & ~(td->hugepage_size - 1); else td->orig_buffer_size += MASK; diff --git a/fio.h b/fio.h index 432c0988..df36f14e 100644 --- a/fio.h +++ b/fio.h @@ -214,6 +214,7 @@ struct thread_data { unsigned int bs[2]; unsigned int min_bs[2]; unsigned int max_bs[2]; + unsigned int hugepage_size; unsigned int rw_min_bs; unsigned int thinktime; unsigned int fsync_blocks; diff --git a/init.c b/init.c index edaec144..4ca5ee6f 100644 --- a/init.c +++ b/init.c @@ -52,6 +52,7 @@ #define DEF_WRITE_BW_LOG (0) #define DEF_WRITE_LAT_LOG (0) #define DEF_NO_RAND_MAP (0) +#define DEF_HUGEPAGE_SIZE FIO_HUGE_PAGE #define td_var_offset(var) ((size_t) &((struct thread_data *)0)->var) @@ -358,6 +359,11 @@ static struct fio_option options[] = { .type = FIO_OPT_STR_SET, .off1 = td_var_offset(bs_unaligned), }, + { + .name = "hugepage-size", + .type = FIO_OPT_STR_VAL, + .off1 = td_var_offset(hugepage_size), + }, { .name = NULL, }, @@ -1058,6 +1064,7 @@ static int fill_def_thread(void) def_thread.write_bw_log = write_bw_log; def_thread.write_lat_log = write_lat_log; def_thread.norandommap = DEF_NO_RAND_MAP; + def_thread.hugepage_size = DEF_HUGEPAGE_SIZE; #ifdef FIO_HAVE_DISK_UTIL def_thread.do_disk_util = 1; #endif -- 2.25.1