Comment by _urga

7 years ago

2007, Linus rant: https://lkml.org/lkml/2007/1/10/233

  The right way to do it is to just not use O_DIRECT. 

  The whole notion of "direct IO" is totally braindamaged. Just say no.

    This is your brain: O
    This is your brain on O_DIRECT: .
    Any questions?

  I should have fought back harder. There really is no valid reason for EVER
  using O_DIRECT. You need a buffer whatever IO you do, and it might as well
  be the page cache. There are better ways to control the page cache than
  play games and think that a page cache isn't necessary.

  So don't use O_DIRECT. Use things like madvise() and posix_fadvise()
  instead.

2019, how things are:

    This is your brain: O
    This is your brain on O_DIRECT: .
    And... this is your brain when cached: ?!

  The right way to do it is to just use O_DIRECT.
  The whole notion of "kernel IO" is fsync and games. Just say no.