public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Wakko Warner <wakko@animx.eu.org>
To: Helge Hafting <helge.hafting@aitel.hist.no>
Cc: Bernd Eckenfels <ecki@lina.inka.de>, linux-kernel@vger.kernel.org
Subject: Re: Swap partition vs swap file
Date: Tue, 12 Jul 2005 17:53:32 -0400	[thread overview]
Message-ID: <20050712215332.GA31021@animx.eu.org> (raw)
In-Reply-To: <42D253B5.20101@aitel.hist.no>

Helge Hafting wrote:
> Wakko Warner wrote:
> You don't need to zero out swapfiles. You can fill them with anything,
> even /dev/urandom.  Zero-filling may be faster though.  A swapfile
> is not zero the second time you use it - then it contains leftovers
> from last time.

I understand this part.

> >So are you saying that if I create a swap partition it's best to use dd to
> >zero it out before mkswap?  If no, then why would a file be different?  I
> >know there's no documented way to create a file of given size without
> >writing content.  I saw windows grow a pagefile several meg in less than a
> >second so I'm sure that it doesn't zero out the space first.
>
> Linux doesn't grow swapfiles at all.  It uses what's there at mkswap time.
> You can make new ones of course - manually.

And this part.  I've never known linux to grow the swap file.  I did try the
sparse one a long time ago.  Of course it didn't work.

> >As far as portable, we're talking about linux, portability is not an issue
> >in this case.  I myself don't use swap files (or partitions), however, 
> >there
> >was a project I recall that would dynamically add/remove swap as needed. 
> >Creating a file of 20-50mb quickly would have been beneficial.
>
> You can create 50M quickly - even if it actually have to be written.  If
> you can't, don't use that device for swap. 

Not all systems can create 50mb in a short time.  Especially when the
system/device is under load.  Not all systems have multiple disks either.

> Ability to allocate some blocks without actually writing to them is nice 
> for this
> purpose, but current linux filesystems doesn't have an api for doing that.
> The necessary changes would touch all existing writeable filesystems, and
> that is a lot of work for very little gain.  As they say, you don't 
> create swapfiles
> all that often.  The time saved on swapfile creation might take a long 
> time to
> make up for the time spent on making, auditing and supporting those
> changes.

I hadn't considered this "portability" so I didn't understand at that
point.

-- 
 Lab tests show that use of micro$oft causes cancer in lab animals

  reply	other threads:[~2005-07-12 21:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-29  0:57 Swap partition vs swap file Mike Richards
2005-06-29  5:03 ` Andrew Morton
2005-06-29 10:37   ` Marat Buharov
2005-06-29 11:46     ` Douglas McNaught
2005-07-07 19:50   ` Mike Richards
2005-07-07 21:59     ` Andrew Morton
2005-07-08  0:44       ` Coywolf Qi Hunt
2005-07-08  1:22         ` Bernd Eckenfels
2005-07-08 15:35           ` Jeremy Nickurak
2005-07-08 21:35             ` Helge Hafting
2005-07-08 22:41             ` Wakko Warner
2005-07-09 22:59               ` Eric Sandall
2005-07-10  1:45                 ` Wakko Warner
2005-07-10  2:14                   ` Bernd Eckenfels
2005-07-10 12:54                     ` Wakko Warner
2005-07-10 21:40                       ` Bernd Eckenfels
2005-07-11 11:10                       ` Helge Hafting
2005-07-12 21:53                         ` Wakko Warner [this message]
2005-07-13 10:58                           ` Jan Engelhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050712215332.GA31021@animx.eu.org \
    --to=wakko@animx.eu.org \
    --cc=ecki@lina.inka.de \
    --cc=helge.hafting@aitel.hist.no \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox