From owner-freebsd-stable Mon May 25 15:41:52 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id PAA23174 for freebsd-stable-outgoing; Mon, 25 May 1998 15:41:52 -0700 (PDT) (envelope-from owner-freebsd-stable@FreeBSD.ORG) Received: from dyson.iquest.net (dyson.iquest.net [198.70.144.127]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id PAA23140 for ; Mon, 25 May 1998 15:41:42 -0700 (PDT) (envelope-from toor@dyson.iquest.net) Received: (from root@localhost) by dyson.iquest.net (8.8.8/8.8.8) id RAA10934; Mon, 25 May 1998 17:39:51 -0500 (EST) (envelope-from toor) From: "John S. Dyson" Message-Id: <199805252239.RAA10934@dyson.iquest.net> Subject: Re: vnconfig + swap with sparse files In-Reply-To: from Robert Watson at "May 25, 98 05:15:57 pm" To: robert@cyrus.watson.org (Robert Watson) Date: Mon, 25 May 1998 17:39:51 -0500 (EST) Cc: dag-erli@ifi.uio.no, stable@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL38 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk > > On 25 May 1998, Dag-Erling Coidan [iso-8859-1] Smørgrav wrote: > > > Robert Watson writes: > > > I rebooted to stop swapping on the file, and modified my creation program > > > to drop a \0 at the beginning of each block. Sure enough, starting > > > swapping this time worked fine. > > > > What you should have done in the first place was: > > > > # dd if=/dev/zero of=swapfile bs=1048576 count=128 > > > > A sparse file cannot possibly work as swap since it does not have any > > space allocate to it on the disk, and you *want* to allocate space on > > the disk - where else are you going to swap out your data? > > I would argue that more intuitive behavior would be for the pager to get > back 0'd pages, as all other users of sparse files do. When I mmap my > sparse file, I get 0's :). While this is more intuitive, it may not in > reality be feasible. However, a note in vn(4) under BUGS indicating that > the vn driver does not automatically allocate pages for sparse files when > used, or documenting its error return on attempting to read or write an > unallocated block in a sparse file would make sense. > > Indeed, I did not expect the pager to swap to my sparse file -- I expected > the file to become un-sparse as it went along. > It is a problematical issue to allocate space during swap pager pageouts. In order to minimize the deadlock issues, the file has to be pre-allocated. When I get swapoff working, I will also make swapon check for files to be properly preallocated. John To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message