From owner-freebsd-hackers Mon Jun 28 14:17:23 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [209.157.86.2]) by hub.freebsd.org (Postfix) with ESMTP id 5286C152F6 for ; Mon, 28 Jun 1999 14:17:19 -0700 (PDT) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.9.3/8.9.1) id OAA24801; Mon, 28 Jun 1999 14:17:13 -0700 (PDT) (envelope-from dillon) Date: Mon, 28 Jun 1999 14:17:13 -0700 (PDT) From: Matthew Dillon Message-Id: <199906282117.OAA24801@apollo.backplane.com> To: Jason Thorpe Cc: Zhihui Zhang , "Daniel J. O'Connor" , freebsd-hackers@FreeBSD.ORG, Ladavac Marino Subject: Re: Implementation of mmap() in FreeBSD References: <199906282107.OAA22292@lestat.nas.nasa.gov> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG :Well, if you make a VM object map-entry-specific (not just "process-specific"; :a single process may have multiple mappings of a file!), then the pages :*can't* be shared, because pages are owned by the objects. The only reason :you can share pages is because multiple map entries may reference the same :object (the offset into the object being map-entry-specific). : :Put another way, it's not possible for this sentence to be true, at all: : : What you propose will not work because even if the VM object is : process-specific, the pages underlying the VM object are not. There's missing information. Remember that VM objects are recursive. That is, they stack in layers. So, in fact, you are sharing the same physical page for both a PRIVATE and SHARED mmap. A copy only occurs if you attempt to modify a page in a PRIVATE mmap. The underlying VM object is, ultimately, the file itself. That's what I meant. You are absolute correct about the high-level mapping occuring in the map-entry. For a shared map it is ultimately the same VM object. :This, of course, would mean that VM objects themselves serve no purpose, so :you could collapse it into "pages are owned by VM map entries", and do away :with objects completely. : :However, that would be stupid. : :Anyhow, it's possible to have the semantics Zhihui suggested, but you have to :give up an awful lot to get them. :-) : : -- Jason R. Thorpe It really isn't possible without creating massive inefficiencies. It would be possible in a MULTICS system, but not in a UNIX system and not with most modern processors ( which do not have byte resolved variable-length page maps ). Not efficiently, anyway. -Matt Matthew Dillon To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message