fio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yuanchu Xie <yuanchu@google.com>
To: Jens Axboe <axboe@kernel.dk>, Vincent Fu <vincentfu@gmail.com>,
	fio@vger.kernel.org
Cc: Yu Zhao <yuzhao@google.com>,
	"T . J . Alumbaugh" <talumbau@google.com>,
	Yuanchu Xie <yuanchu@google.com>
Subject: [PATCH v2 1/2] fio: add support for POSIX_FADV_NOREUSE
Date: Fri, 31 Mar 2023 11:37:02 -0700	[thread overview]
Message-ID: <20230331183703.3145788-1-yuanchu@google.com> (raw)

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>
---
 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


             reply	other threads:[~2023-03-31 18:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-31 18:37 Yuanchu Xie [this message]
2023-03-31 18:37 ` [PATCH v2 2/2] docs: add noreuse fadvise_hint option Yuanchu Xie
2023-03-31 18:41 ` [PATCH v2 1/2] fio: add support for POSIX_FADV_NOREUSE Jens Axboe
2023-03-31 18:54   ` Jens Axboe
2023-03-31 18:54 ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230331183703.3145788-1-yuanchu@google.com \
    --to=yuanchu@google.com \
    --cc=axboe@kernel.dk \
    --cc=fio@vger.kernel.org \
    --cc=talumbau@google.com \
    --cc=vincentfu@gmail.com \
    --cc=yuzhao@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).