Re: wrong madvise(MADV DONTNEED) semantic

From: Jamie Lokier
Date: Wed Jun 29 2005 - 12:31:56 EST


Michael Kerrisk wrote:
> For a MAP_SHARED region, the kernel may discard modified
> pages, depending on the architecture. (I seem to recall
> getting this information about architecture variation from
> an email conversation with Jamie Lokier; I haven't
> verified it. On x86 at least, I haven't seen an pages
> discarded for MADV_DONTNEED on a MAP_SHARED region.)

The discard in MAP_SHARED case isn't explicit. It's due to CPU cache
incoherency, so the data (or just some of the data) is lost simply by
not syncing properly between userspace and the page cache.

It wouldn't be apparent on fully-coherent architectures like x86.

That was when I last looked at the code (during the 2.5 time frame).
I didn't test it, only examined the code, but quite thoroughly.

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