fio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Isawan Millican <linux@isawan.net>
To: fio@vger.kernel.org
Subject: fadvise_hint behavior unclear from documentation
Date: Sat, 18 Sep 2021 23:46:47 +0100	[thread overview]
Message-ID: <769eb00b-fa01-a9f1-4fcc-09f4f7bbce38@isawan.net> (raw)

Hi,

I was using fio and noticed that the throughput was lower than expected for
random reads to a small file; I would expect it to be entirely cached in
memory. The issue seems to be because fadvise_hint=0 is not behaving as
documented as POSIX_FADV_DONTNEED is being called.
This might be the intended bahavior as the program is flushing the pages
to purely test IO throughput

If the current behaviour is intentional, is there an existing flag that 
could
provide the desired functionality? Essentially I'd like to test the IO
throughput of various file sizes without bypassing the page cache to see the
effects of caching.

To reproduce:

Version:
     Built from source from master (commit f3057d268d)
     Output of /fio --version
         fio-3.28-18-gf3057

We can see fadvise is being used when ran with strace:

     isawan@hypermachine:~/Software/fio$ strace -f  -e fadvise64 ./fio  
--name=test-reader --ioengine=mmap --readwrite=randread --readonly 
--filename=/tmp/test --bs=4k --size=128M --numjobs=1 --runtime=30s 
--time_based --buffered=1 --allow_file_create=0 --fadvise_hint=0
     test-reader: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 
4096B-4096B, (T) 4096B-4096B, ioengine=mmap, iodepth=1
     fio-3.28-18-gf3057
     strace: Process 28297 attached
     strace: Process 28298 attached
     strace: Process 28299 attached
     strace: Process 28300 attached
     strace: Process 28301 attached
     strace: Process 28302 attached
     strace: Process 28303 attached
     strace: Process 28304 attached
     [pid 28301] +++ exited with 0 +++
     [pid 28297] +++ exited with 0 +++
     [pid 28303] +++ exited with 0 +++
     [pid 28298] +++ exited with 0 +++
     [pid 28299] +++ exited with 0 +++
     [pid 28304] +++ exited with 0 +++
     [pid 28302] +++ exited with 0 +++
     [pid 28300] +++ exited with 0 +++
     strace: Process 28305 attached
     Starting 1 process
     strace: Process 28306 attached
     [pid 28306] fadvise64(6, 0, 134217728, POSIX_FADV_DONTNEED) = 0
     [pid 28306] fadvise64(6, 0, 134217728, POSIX_FADV_DONTNEED) = 0
     [pid 28306] fadvise64(6, 0, 134217728, POSIX_FADV_DONTNEED) = 0
     [pid 28306] fadvise64(6, 0, 134217728, POSIX_FADV_DONTNEED) = 0
     [pid 28306] fadvise64(6, 0, 134217728, POSIX_FADV_DONTNEED) = 0
     [pid 28306] fadvise64(6, 0, 134217728, POSIX_FADV_DONTNEED) = 0
     [pid 28306] fadvise64(6, 0, 134217728, POSIX_FADV_DONTNEED) = 0
     [pid 28306] fadvise64(6, 0, 134217728, POSIX_FADV_DONTNEED) = 0
     [pid 28306] fadvise64(6, 0, 134217728, POSIX_FADV_DONTNEED) = 0
     [pid 28306] fadvise64(6, 0, 134217728, POSIX_FADV_DONTNEED) = 0
     [pid 28306] fadvise64(6, 0, 134217728, POSIX_FADV_DONTNEED) = 0
     [pid 28306] fadvise64(6, 0, 134217728, POSIX_FADV_DONTNEED) = 0

As we see here, fadvise is being called, while the documentation states:

     fadvise_hint=str

         Use posix_fadvise(2) or posix_fadvise(2) to advise the kernel 
on what I/O patterns are likely to be issued.
         Accepted values are:
             "0": Backwards-compatible hint for “no hint”


             reply	other threads:[~2021-09-18 22:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-18 22:46 Isawan Millican [this message]
2021-09-19  2:31 ` fadvise_hint behavior unclear from documentation 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=769eb00b-fa01-a9f1-4fcc-09f4f7bbce38@isawan.net \
    --to=linux@isawan.net \
    --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;
as well as URLs for NNTP newsgroup(s).