MS_INVALIDATE broken, what alternative?

From: Michael Kerrisk
Date: Wed Apr 28 2004 - 04:52:22 EST


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
michael.kerrisk@xxxxxxx





-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/