1. 2
  1. 4

    The middle bit when he is making fun of - no, really aggressively attacking - someone for asking a question on StackOverflow is incredibly bad and off-putting.

    What’s worse is that it seems like a reasonable question:

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

    The MADV_DONTNEED semantics Cantrill seems to prefer is the BSD+Solaris semantics where the content is not thrown away, just made low priority for keeping in memory (that is, flushed back to disk for an mmap’ed file or paged to swap for non-file-backed memory). In that case, yes, that seems like lazily writing to disk is exactly what would happen as a result.

    And if you read the question text, the author clearly understands this nuance. Now, on Linux, it’s definitely a bad idea since MADV_DONTNEED does throw away the data. But the question seems entirely reasonable, especially as elaborated in the full text.

    It definitely looks for all the world like Cantrill is attacking someone using a caricature of what they actually said, and even that caricature is actually reasonable once you see through the attack. Not a good look.

    1. 2

      The Title is a bit odd, because it don’t says what this rant is about. Better would be something like “Linux MADV_DONTNEED is broken”.

      This shows the downside of the never break user space policy. I would call this a bug in the API. But because some applications depend on this bug Linux don’t change the API. Therefor applications who use this on other OS must take care of the broken API when porting to Linux.