From: Jens Axboe <axboe@kernel.dk>
To: Robert Elliott <elliott@hpe.com>, fio@vger.kernel.org
Subject: Re: [RFC] mmap: under direct=1, only call msync and madvise on writes
Date: Tue, 24 Jul 2018 09:49:42 -0600 [thread overview]
Message-ID: <144b5dde-2ea3-b65a-9641-c65c0d418dc8@kernel.dk> (raw)
In-Reply-To: <20180714001924.34861-1-elliott@hpe.com>
On 7/13/18 6:19 PM, Robert Elliott wrote:
> While using the mmap engine with direct=1 (an artificial combination),
> only call msync() and madvise(DONTNEED) for writes; don't worry about
> reads.
>
> This better simulates an application that periodically wants to flush
> updated data to disk, but wants to keep read data in memory.
>
> Signed-off-by: Robert Elliott <elliott@hpe.com>
> ---
> engines/mmap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/engines/mmap.c b/engines/mmap.c
> index 308b4665..cacf1768 100644
> --- a/engines/mmap.c
> +++ b/engines/mmap.c
> @@ -205,7 +205,7 @@ static enum fio_q_status fio_mmapio_queue(struct thread_data *td,
> /*
> * not really direct, but should drop the pages from the cache
> */
> - if (td->o.odirect && ddir_rw(io_u->ddir)) {
> + if (td->o.odirect && (io_u->ddir == DDIR_WRITE || io_u->ddir == DDIR_TRIM)) {
> if (msync(io_u->mmap_data, io_u->xfer_buflen, MS_SYNC) < 0) {
> io_u->error = errno;
> td_verror(td, io_u->error, "msync");
Looks fine, but might be a good idea to add a ddir_write() helper for it.
Maybe fio_ro_check() can use it too.
--
Jens Axboe
prev parent reply other threads:[~2018-07-24 15:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-14 0:19 [RFC] mmap: under direct=1, only call msync and madvise on writes Robert Elliott
2018-07-24 15:49 ` Jens Axboe [this message]
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=144b5dde-2ea3-b65a-9641-c65c0d418dc8@kernel.dk \
--to=axboe@kernel.dk \
--cc=elliott@hpe.com \
--cc=fio@vger.kernel.org \
/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