fio: add support for POSIX_FADV_NOREUSE
PATCH 1/2 fio: add support for POSIX_FADV_NOREUSE
As of Linux kernel commit 17e810229cb3 ("mm: support POSIX_FADV_NOREUSE"), POSIX_FADV_NOREUSE hints at the LRU algorithm to ignore accesses to mapped files with this flag. Previously, it was a no-op.
Add it in fio as an fadvise_hint option to test the new behavior.
Signed-off-by Yuanchu Xie <[email protected]>
--- fio.h | 1 + ioengines.c | 2 ++ options.c | 4 ++++ 3 files changed, 7 insertions(+)
fio.h +1 -0
@@ -163,6 +163,7 @@ enum {F_ADV_TYPE ,F_ADV_RANDOM ,F_ADV_SEQUENTIAL , + F_ADV_NOREUSE, };/*
ioengines.c +2 -0
@@ -565,6 +565,8 @@ int td_io_open_file(struct thread_data *td, struct fio_file *f) flags =POSIX_FADV_RANDOM ; else if (td->o.fadvise_hint == F_ADV_SEQUENTIAL) flags =POSIX_FADV_SEQUENTIAL ; + else if (td->o.fadvise_hint == F_ADV_NOREUSE) + flags =POSIX_FADV_NOREUSE ; else {log_err ("fio: unknown fadvise type %d\n" , td->o.fadvise_hint);
options.c +4 -0
@@ -2740,6 +2740,10 @@ struct fio_option fio_options[FIO_MAX_OPTS] = { .oval = F_ADV_SEQUENTIAL, .help = "Advise using FADV_SEQUENTIAL", }, + { .ival = "noreuse", + .oval = F_ADV_NOREUSE, + .help = "Advise using FADV_NOREUSE", + }, }, .help = "Use fadvise() to advise the kernel on IO pattern", .def = "1",
Signature · 1 line
2.40.0.348.gf938b09366-goog
PATCH 2/2 docs: add noreuse fadvise_hint option
noreuse was added as an fadvise_hint option to apply POSIX_FADV_NOREUSE, so we add it to the docs as well.
Signed-off-by Yuanchu Xie <[email protected]>
--- fio.1 | 3 +++ 1 file changed, 3 insertions(+)
fio.1 +3 -0
@@ -1098,6 +1098,9 @@ Advise using FADV_SEQUENTIAL. .TP .B random Advise using FADV_RANDOM. +.TP +.B noreuse +Advise using FADV_NOREUSE. .RE .RE .TP
Signature · 1 line
2.40.0.348.gf938b09366-goog
Re: [PATCH 2/2] docs: add noreuse fadvise_hint option
Quoted 2 lines · Yuanchu Xie
noreuse was added as an
fadvise_hintoption to applyPOSIX_FADV_NOREUSE, so we add it to the docs as well.
Can you do the HOWTO as well?
Apart from that oversight, looks fine to me.
Signature · 1 line
Jens Axboe