On Mon, 1 Aug 2005, Linus Torvalds wrote: > > Of course, if VM_MAYWRITE is not set, you could just convert it silently > to a MAP_PRIVATE at the VM level (that's literally what we used to do, > back when we didn't support writable shared mappings at all, all those > years ago), so at least now the COW behaviour would match the vma_flags.
Heh. I just checked. We still do exactly that: if (!(file->f_mode & FMODE_WRITE)) vm_flags &= ~(VM_MAYWRITE | VM_SHARED); some code never dies ;) However, we still set the VM_MAYSHARE bit, and thats' the one that mm/rmap.c checks for some reason. I don't see quite why - VM_MAYSHARE doesn't actually ever do anything else than make sure that we try to allocate a mremap() mapping in a cache-coherent space, I think (ie it's a total no-op on any sane architecture, and as far as rmap is concerned on all of them). Linus - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/