From owner-freebsd-hackers@FreeBSD.ORG Tue Nov 15 11:27:27 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A0BC416A41F for ; Tue, 15 Nov 2005 11:27:27 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5BA4343D46 for ; Tue, 15 Nov 2005 11:27:27 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [209.31.154.41]) by cyrus.watson.org (Postfix) with ESMTP id 3DE7D46B3E; Tue, 15 Nov 2005 06:27:26 -0500 (EST) Date: Tue, 15 Nov 2005 11:27:26 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Peter Jeremy In-Reply-To: <20051115080022.GI39882@cirb503493.alcatel.com.au> Message-ID: <20051115112118.D63879@fledge.watson.org> References: <20051115080022.GI39882@cirb503493.alcatel.com.au> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-hackers@freebsd.org, John Giacomoni Subject: Re: Sharing the same VM address space between Kernel and UserSpace X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Nov 2005 11:27:27 -0000 On Tue, 15 Nov 2005, Peter Jeremy wrote: > Avoiding other mappings isn't that difficult, though it's not totally > trivial. You need to avoid KVA, stack, text, heap, shared libraries, > SysV SHM and other random mmap()'s. If this is a fairly custom > application, you can get a fairly good idea of what other mappings exist > and just ensure that you pick an unused address and mmap it fairly > early. If you need to allocate a very large region (getting towards the > GB region) or this is part of a library that is supposed to be linked > into arbitrary applications then things may be more difficult. This used to be something of a problem in Coda, because we used RVM (Recoverable Virtual Memory) to provide transactional persistent virtual memory. We required a large memory region (generally >128mb) that we could use at the same virtual address base over long runtimes and across reboots -- potentially years or more, since rewriting the memory region was a very expensive and complex process. The VM space would get perturbed every few years due to migrations to ELF, etc, requiring conversion to new addresses. The RVM code had to run early in process execution to prevent VM space fragmentation from becoming a problem also. I imagine that on 64-bit address space systems, life is much easier, but on 32-bit systems even in 1998 we had significant problems with this across many operating systems. So not that it can't be done, but it can be a problem. It might well be worth looking at the address usage in Coda to find some reference use, though, as Coda runs on a number of systems quite successfully, and uses RVM in both the client and server. Robert N M Watson