[PATCH 1/2] fio: add support for POSIX_FADV_NOREUSE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 fio.h       | 1 +
 ioengines.c | 2 ++
 options.c   | 4 ++++
 3 files changed, 7 insertions(+)

diff --git a/fio.h b/fio.h
index 32535517..f2acd430 100644
--- a/fio.h
+++ b/fio.h
@@ -163,6 +163,7 @@ enum {
 	F_ADV_TYPE,
 	F_ADV_RANDOM,
 	F_ADV_SEQUENTIAL,
+	F_ADV_NOREUSE,
 };
 
 /*
diff --git a/ioengines.c b/ioengines.c
index e2316ee4..56759c53 100644
--- a/ioengines.c
+++ b/ioengines.c
@@ -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);
diff --git a/options.c b/options.c
index 18857795..fe580ebb 100644
--- 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",
-- 
2.40.0.348.gf938b09366-goog




[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux