From owner-freebsd-hackers Sun Sep 30 13: 6:29 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from elvis.mu.org (elvis.mu.org [216.33.66.196]) by hub.freebsd.org (Postfix) with ESMTP id 3C7F937B408 for ; Sun, 30 Sep 2001 13:06:26 -0700 (PDT) Received: by elvis.mu.org (Postfix, from userid 1192) id 0FEB281D01; Sun, 30 Sep 2001 15:06:26 -0500 (CDT) Date: Sun, 30 Sep 2001 15:06:26 -0500 From: Alfred Perlstein To: Matt Dillon Cc: Poul-Henning Kamp , Vladimir Dozen , Wilko Bulte , hackers@FreeBSD.ORG Subject: Re: VM: dynamic swap remapping (patch) Message-ID: <20010930150626.N59854@elvis.mu.org> References: <909.1001839737@critter> <200109301959.f8UJxN544635@earth.backplane.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200109301959.f8UJxN544635@earth.backplane.com>; from dillon@earth.backplane.com on Sun, Sep 30, 2001 at 12:59:23PM -0700 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG * Matt Dillon [010930 14:59] wrote: > > : > :In message <200109300752.f8U7qsj41649@earth.backplane.com>, Matt Dillon writes: > :>: Second, application not always grows to 1G, most of the time it keeps > :>: as small as 500M ;). Why should we precommit 1G for 500M data? Doing > :>: multi-mmap memory management is additional pain. > :> > :> Even using file-backed memory is fairly trivial. You don't need to > :> do multi-mmap memory management or do any kernel tweaking. Just > :> reserve 1G and use a single mmap() and file per process. > : > :I once had a patch to phkmalloc() which backed all malloc'ed VM with > :hidden files in the users homedir. It was written to put the VM > :usage under QUOTA control, but it had many useful side effects as well. > : > :I can't seem to find it right now, but it is trivial to do: just > :replace the sbrk(2) with mmap(). Only downside is the needed > :filedescriptor which some shells don't like. > : > :-- > :Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 > :phk@FreeBSD.ORG | TCP/IP since RFC 956 > > I think the file descriptor problem can be solved easily... simply > open the file, mmap() the entire 1G segment for this special application, > and then close() the file. Then have sbrk() just eats out of the mapped > segment. Alternatively sbrk() could open/mmap/close in large 1MB or 4MB > segments, again leaving no file descriptors dangling. Won't that cause fragmentation? You're forgettng the need to ftruncate or pre-zero the file unless that's been fixed. -- -Alfred Perlstein [alfred@freebsd.org] 'Instead of asking why a piece of software is using "1970s technology," start asking why software is ignoring 30 years of accumulated wisdom.' To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message