Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 May 1998 17:39:51 -0500 (EST)
From:      "John S. Dyson" <toor@dyson.iquest.net>
To:        robert@cyrus.watson.org (Robert Watson)
Cc:        dag-erli@ifi.uio.no, stable@FreeBSD.ORG
Subject:   Re: vnconfig + swap with sparse files
Message-ID:  <199805252239.RAA10934@dyson.iquest.net>
In-Reply-To: <Pine.BSF.3.96.980525170957.5875A-100000@cyrus.watson.org> from Robert Watson at "May 25, 98 05:15:57 pm"

next in thread | previous in thread | raw e-mail | index | archive | help

> 
> On 25 May 1998, Dag-Erling Coidan [iso-8859-1] Smørgrav  wrote:
> 
> > Robert Watson <robert@cyrus.watson.org> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199805252239.RAA10934>