Re: [PATCH] Alternate futex non-page-pinning and COW fix

From: Hugh Dickins
Date: Wed Sep 03 2003 - 13:06:36 EST


On Wed, 3 Sep 2003, Linus Torvalds wrote:
>
> Actually: the VM_SHARED flag will never change, so testing VM_SHARED is
> actually the _right_ thing from a mm perspective.
>
> The only person who should ever test VM_MAYSHARE is somebody who does
> reporting back to user space: VM_MAYSHARE basically ends up meaning "the
> user _asked_ for a shared mapping". While "VM_SHARED" means "this mapping
> can actually contain a shared dirty page".
>
> The VM itself should only ever care about VM_SHARED. Because that's the
> only bit that has real semantic meaning.

To that part of the kernel interested in dirty pages, yes.
But when interested in futexes, it seems not.

If we're going to document a behaviour as depending on whether the user
said MAP_SHARED or MAP_PRIVATE, then it's VM_MAYSHARE we should check to
decide which behaviour to use.

We could use VM_SHARED, and document the behaviour of the futex as
depending on whether it's in an area that was MAP_SHARED from a file
which was opened for writing as well as reading - but do we really
want to complicate the documentation that way? Principle of least
least surprise, principle of minimal doc.

Hugh

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