1

I've been doing some research on madvise.

Example:

https://www.youtube.com/watch?v=bg6-LVCHmGM&feature=youtu.be&t=1h13m24s

Does madvise(___, ___, MADV_DONTNEED) instruct the OS to lazily write to disk?

This indicates that the dirty pages will not be written to disk if madvise is called.

Is the behavior of posix_fadvise the same when called with POSIX_FADV_DONTNEED?

If the behavior is the same, what happens when posix_fadvise is called for a file that is opened in two separate files?

Do the dirty pages on the other process get evicted without being written to disk?

Kim Ebert
  • 11
  • 2
  • Remember that `madvice`/`fadvice` are merely *hints* to the kernel - it's not obligated to actually *do* anything if it doesn't feel like it. – Jesper Juhl Oct 08 '18 at 18:08
  • The kernel does respond to the advise, so the question is what is the behavior of the kernel to the advise. – Kim Ebert Oct 08 '18 at 18:14

1 Answers1

0

No. Everything about Linux MADV_DONTNEED is contrary to POSIX semantics and not usable for implementation of posix_madvise or posix_fadvise. It's only relevant if you call the non-standardized madvise function.

R.. GitHub STOP HELPING ICE
  • 208,859
  • 35
  • 376
  • 711