That's what MS_ASYNC already does.
Yes, in violation of the SuS spec. That's what msync(0) already does,
too, so the linux-specific extension already exists.
The standard description of MS_INVALIDATE is very confusing and poorly
worded, but I think it's designed for a model where mmap() copies rather
than playing page table tricks, and the OS has to copy the dirty pages
back and forth between the buffer cache "by hand". Looked at that way,
the MS_INVALIDATE wording seems to be intended as something of a "commit
memory writes back to the file system level" operation.
Which could also be expected to cause the traditional 30-second sync
timeout to start applying to the written data. In the current Linux