Re: msync() behaviour broken for MS_ASYNC, revert patch?

From: Stephen C. Tweedie
Date: Thu Apr 01 2004 - 12:02:03 EST


Hi,

On Thu, 2004-04-01 at 17:19, Jamie Lokier wrote:
> Stephen C. Tweedie wrote:
> > Yes, but we _used_ to have that choice --- call msync() with flags == 0,
> > and you'd get the deferred kupdated writeback;
>
> Is that not equivalent to MS_INVALIDATE? It seems to be equivalent in
> 2.6.4.

It is in all the kernels I've looked at, but that's mainly because we
seem to ignore MS_INVALIDATE.

> Some documentation I'm looking at says MS_INVALIDATE updates the
> mapped page to contain the current contents of the file. 2.6.4 seems
> to do the reverse: update the file to contain the current content of
> the mapped page. "man msync" agrees with the the latter. (I can't
> look at SUS right now).

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.

which seems to imply that dirty ptes should simply be cleared, rather
than propagated to the page dirty bits.

That's easy enough --- we already propagate the flags down to
filemap_sync_pte, where the page and pte dirty bits are modified. Does
anyone know any reason why we don't do MS_INVALIDATE there already?

--Stephen


-
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/