Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S263659AbTICR4R (ORCPT ); Wed, 3 Sep 2003 13:56:17 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S263710AbTICR4Q (ORCPT ); Wed, 3 Sep 2003 13:56:16 -0400 Received: from fw.osdl.org ([65.172.181.6]:18630 "EHLO mail.osdl.org") by vger.kernel.org with ESMTP id S263659AbTICR4M (ORCPT ); Wed, 3 Sep 2003 13:56:12 -0400 Date: Wed, 3 Sep 2003 10:55:51 -0700 (PDT) From: Linus Torvalds To: Jamie Lokier cc: Hugh Dickins , Rusty Russell , Andrew Morton , Ingo Molnar , Subject: Re: [PATCH] Alternate futex non-page-pinning and COW fix In-Reply-To: <20030903173928.GA22555@mail.jlokier.co.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1318 Lines: 33 On Wed, 3 Sep 2003, Jamie Lokier wrote: > > Hugh Dickins wrote: > > > Good question. No kernel code seems to check VM_MAYSHARE - the one to > > > check is VM_SHARED. > > > > Observe fs/procfs/task_mmu.c show_map checking VM_MAYSHARE for 's'. > > Observe mm/mmap.c do_mmap_pgoff vm_flags &= ~(VM_MAYWRITE | VM_SHARED). > > VM_MAYSHARE reflects whether user chose MAP_SHARED, VM_SHARED may not. > > Hugh, thank you. In the case of futex.c, either flag could be used to > mean "is this a shared" mapping, and each choice has a different > user-visible meaning. 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. Linus - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/