Skip to contentSkip to conversation

MS_INVALIDATE broken, what alternative?

DISCUSSION Michael Kerrisk 1 participant 1 message Apr 28, 2004

lore
Share & tools
lore
#0 lore raw

Gidday,

The msync() MS_INVALIDATE operation should produce behavior something like the following:

Invalidate cached copies of mapped data: the mapped region is synchronized with the contents of the file. All pages of the mapped region that are inconsistent with the underlying file data are marked as invalid, and when next referenced, the contents of the page will be copied from the corresponding location in the file. As a result, any changes that have been made directly to the file by another process using write() are made visible in the mapped region.

(To be precise, SUSv3 says:

When MS_INVALIDATE is specified, msync( ) shall invalidate all cached copies of mapped data that are inconsistent with the permanent storage locations such that subsequent references shall obtain data that was consistent with the permanent storage locations sometime between the call to msync( ) and the first subsequent memory reference to the data.
)

However as noted in a recent thread
(http://marc.theaimsgroup.com/?l=linux-kernel&m=108083668427418&w=2),
the current Linux implementation of this flag is broken: it provides behavior equivalent to flags==0.

Is there any way of achieving this functionality with current kernels? (Or might MS_INVALIDATE actually get correctly implemented?)

Thanks,

Michael
--
Michael Kerrisk
[email protected]