fio: add support for POSIX_FADV_NOREUSE
authorYuanchu Xie <yuanchu@google.com>
Fri, 31 Mar 2023 18:37:02 +0000 (11:37 -0700)
committerJens Axboe <axboe@kernel.dk>
Fri, 31 Mar 2023 18:39:19 +0000 (12:39 -0600)
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 <yuanchu@google.com>
Link: https://lore.kernel.org/r/20230331183703.3145788-1-yuanchu@google.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fio.h
ioengines.c
options.c

diff --git a/fio.h b/fio.h
index 325355174bd37c1134bb3d492a3f4aecee5e10c7..f2acd4302b39a3c82cb314643e8dbe8c73d67ed8 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -163,6 +163,7 @@ enum {
        F_ADV_TYPE,
        F_ADV_RANDOM,
        F_ADV_SEQUENTIAL,
+       F_ADV_NOREUSE,
 };
 
 /*
index e2316ee4e391d0d5899c960552fec4d19aa33ca2..56759c532543744821078bb3fe5129cba25b49f4 100644 (file)
@@ -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);
index 18857795e3c53b0c5c9f647e21a5e4552c0fab9e..fe580ebb9d8f9d31ac7bb7ccdb5c872bea310ef1 100644 (file)
--- a/options.c
+++ b/options.c
@@ -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",