* Re: [announce] swap mini-howto
@ 2002-11-03 10:56 Gabor MICSKO
0 siblings, 0 replies; 18+ messages in thread
From: Gabor MICSKO @ 2002-11-03 10:56 UTC (permalink / raw)
To: linux-kernel
Hi!
I translated this doc to Hungarian language. You can read the translated
doc this url:
http://www.hup.hu/modules.php?name=News&file=article&sid=1976
Cheers,
trey
-----------------------------------
Micskó Gábor
Compaq Accredited Platform Specialist, System Engineer (APS, ASE)
Szintézis Computer Rendszerház Kft.
H-9021 Gyor, Tihanyi Árpád út. 2.
Tel: +36-96-502-216
Fax: +36-96-318-658
E-mail: gmicsko@szintezis.hu
^ permalink raw reply [flat|nested] 18+ messages in thread
* [announce] swap mini-howto
@ 2002-11-01 23:58 Randy.Dunlap
2002-11-02 0:09 ` Dave Jones
` (3 more replies)
0 siblings, 4 replies; 18+ messages in thread
From: Randy.Dunlap @ 2002-11-01 23:58 UTC (permalink / raw)
To: linux-kernel
Hi,
Last week I was looking for a swap-space (mini) HOWTO and
didn't find one, so I threw one together quickly. It's at
http://www.xenotime.net/linux/swap-mini-howto.txt
(Yeah, I know that this isn't a tough subject, but sometimes
people need something like this.)
I'm sure that it has some things that need to be corrected,
so if any of you could send such corrections to me, I'd
appreciate it.
Anyone have suggestions for where this should/could live,
like tldp.org or kernelnewbies.org etc.?
(other than where it is :)
Thanks,
--
~Randy
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [announce] swap mini-howto
2002-11-01 23:58 Randy.Dunlap
@ 2002-11-02 0:09 ` Dave Jones
2002-11-02 0:07 ` Randy.Dunlap
2002-11-02 0:46 ` Andrew Morton
2002-11-02 0:19 ` Andries Brouwer
` (2 subsequent siblings)
3 siblings, 2 replies; 18+ messages in thread
From: Dave Jones @ 2002-11-02 0:09 UTC (permalink / raw)
To: Randy.Dunlap; +Cc: linux-kernel
On Fri, Nov 01, 2002 at 03:58:27PM -0800, Randy.Dunlap wrote:
>
> Hi,
>
> Last week I was looking for a swap-space (mini) HOWTO and
> didn't find one, so I threw one together quickly. It's at
> http://www.xenotime.net/linux/swap-mini-howto.txt
> (Yeah, I know that this isn't a tough subject, but sometimes
> people need something like this.)
I could have sworn I've seen one of these before..
> I'm sure that it has some things that need to be corrected,
> so if any of you could send such corrections to me, I'd
> appreciate it.
Might be nice to mention that using multiple swap partitions
on different disks will 'stripe' requests across disks a-la-raid0
Dave
--
| Dave Jones. http://www.codemonkey.org.uk
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [announce] swap mini-howto
2002-11-02 0:09 ` Dave Jones
@ 2002-11-02 0:07 ` Randy.Dunlap
2002-11-02 0:46 ` Andrew Morton
1 sibling, 0 replies; 18+ messages in thread
From: Randy.Dunlap @ 2002-11-02 0:07 UTC (permalink / raw)
To: Dave Jones; +Cc: linux-kernel
On Sat, 2 Nov 2002, Dave Jones wrote:
| On Fri, Nov 01, 2002 at 03:58:27PM -0800, Randy.Dunlap wrote:
| >
| > Hi,
| >
| > Last week I was looking for a swap-space (mini) HOWTO and
| > didn't find one, so I threw one together quickly. It's at
| > http://www.xenotime.net/linux/swap-mini-howto.txt
| > (Yeah, I know that this isn't a tough subject, but sometimes
| > people need something like this.)
|
| I could have sworn I've seen one of these before..
I expected to find one, but I searched and searched...
| > I'm sure that it has some things that need to be corrected,
| > so if any of you could send such corrections to me, I'd
| > appreciate it.
|
| Might be nice to mention that using multiple swap partitions
| on different disks will 'stripe' requests across disks a-la-raid0
Yep, will do.
--
~Randy
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [announce] swap mini-howto
2002-11-02 0:09 ` Dave Jones
2002-11-02 0:07 ` Randy.Dunlap
@ 2002-11-02 0:46 ` Andrew Morton
2002-11-02 8:26 ` Jeff Garzik
` (2 more replies)
1 sibling, 3 replies; 18+ messages in thread
From: Andrew Morton @ 2002-11-02 0:46 UTC (permalink / raw)
To: Dave Jones; +Cc: Randy.Dunlap, linux-kernel
Dave Jones wrote:
>
> Might be nice to mention that using multiple swap partitions
> on different disks will 'stripe' requests across disks a-la-raid0
>
Yup.
Something I'd like to point out here: in 2.4 and earlier, swapfiles
are less robust than swap devices - the need to go and read metadata
from the filesystem made them prone to oom deadlocks allocating pages
and buffer_heads with which to perform the swapout.
That has changed in 2.5. Swapping onto a regular file has no
disadvantage wrt swapping onto a block device. The kernel does
not need to allocate any memory at all to get a swapcache page
onto disk.
Which is interesting. Because swapfiles are much easier to administer,
and much easier to stripe. Adding, removing and resizing is simplified.
Distributors of 2.6-based kernels could consider doing away with
swapdevs altogether.
If you have two disks then it is very sensible to create a swapfile on
each one and to perform an equal-priority stripe between them. This
will give the best raw swap IO bandwidth. But it could cause additional
seeking between swap and regular file data.
Dedicating an entire disk to swap will obviously reduce the seeking
problem.
But really, if your application is dependent on swap performance, you
need more RAM. Swap should be viewed as a lightweight background
optimisation to make unused pages available for other work, rather
than as a cure for an underprovisioned machine.
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [announce] swap mini-howto
2002-11-02 0:46 ` Andrew Morton
@ 2002-11-02 8:26 ` Jeff Garzik
2002-11-02 10:02 ` Andrew Morton
2002-11-02 11:22 ` Troels Walsted Hansen
2002-11-02 16:55 ` Pavel Machek
2 siblings, 1 reply; 18+ messages in thread
From: Jeff Garzik @ 2002-11-02 8:26 UTC (permalink / raw)
To: Andrew Morton; +Cc: Dave Jones, Randy.Dunlap, linux-kernel
Andrew Morton wrote:
>Something I'd like to point out here: in 2.4 and earlier, swapfiles
>are less robust than swap devices - the need to go and read metadata
>from the filesystem made them prone to oom deadlocks allocating pages
>and buffer_heads with which to perform the swapout.
>
>That has changed in 2.5. Swapping onto a regular file has no
>disadvantage wrt swapping onto a block device. The kernel does
>not need to allocate any memory at all to get a swapcache page
>onto disk.
>
>Which is interesting. Because swapfiles are much easier to administer,
>and much easier to stripe. Adding, removing and resizing is simplified.
>Distributors of 2.6-based kernels could consider doing away with
>swapdevs altogether.
>
>
That said, I would like to again point out that using sparse swapfiles
should still be discouraged. It may be supported, but it's much better
for system performance and stability, IMO, if the sysadmin makes certain
all swapfiles are 100% allocated before they are mentioned to the swap
subsystem.
Jeff
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [announce] swap mini-howto
2002-11-02 8:26 ` Jeff Garzik
@ 2002-11-02 10:02 ` Andrew Morton
2002-11-02 23:31 ` Jeff Garzik
0 siblings, 1 reply; 18+ messages in thread
From: Andrew Morton @ 2002-11-02 10:02 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Dave Jones, Randy.Dunlap, linux-kernel
Jeff Garzik wrote:
>
> ...
> That said, I would like to again point out that using sparse swapfiles
> should still be discouraged. It may be supported, but it's much better
> for system performance and stability, IMO, if the sysadmin makes certain
> all swapfiles are 100% allocated before they are mentioned to the swap
> subsystem.
>
That got stamped out. swapon will fail if the file isn't fully
instantiated on disk:
static int setup_swap_extents(struct swap_info_struct *sis)
{
...
block = bmap(inode, probe_block + block_in_page);
if (block == 0)
goto bad_bmap;
...
bad_bmap:
printk(KERN_ERR "swapon: swapfile has holes\n");
ret = -EINVAL;
}
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [announce] swap mini-howto
2002-11-02 10:02 ` Andrew Morton
@ 2002-11-02 23:31 ` Jeff Garzik
0 siblings, 0 replies; 18+ messages in thread
From: Jeff Garzik @ 2002-11-02 23:31 UTC (permalink / raw)
To: Andrew Morton; +Cc: Dave Jones, Randy.Dunlap, linux-kernel
Andrew Morton wrote:
>That got stamped out. swapon will fail if the file isn't fully
>instantiated on disk:
>
>
>static int setup_swap_extents(struct swap_info_struct *sis)
>{
> ...
> block = bmap(inode, probe_block + block_in_page);
> if (block == 0)
> goto bad_bmap;
> ...
>
>bad_bmap:
> printk(KERN_ERR "swapon: swapfile has holes\n");
> ret = -EINVAL;
>}
>
>
I am in further awe of you.
Jeff
^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: [announce] swap mini-howto
2002-11-02 0:46 ` Andrew Morton
2002-11-02 8:26 ` Jeff Garzik
@ 2002-11-02 11:22 ` Troels Walsted Hansen
2002-11-04 10:47 ` Richard Russon
2002-11-02 16:55 ` Pavel Machek
2 siblings, 1 reply; 18+ messages in thread
From: Troels Walsted Hansen @ 2002-11-02 11:22 UTC (permalink / raw)
To: 'Andrew Morton'; +Cc: linux-kernel
Andrew Morton wrote:
> Something I'd like to point out here: in 2.4 and earlier, swapfiles
> are less robust than swap devices - the need to go and read metadata
> from the filesystem made them prone to oom deadlocks allocating pages
> and buffer_heads with which to perform the swapout.
>
> That has changed in 2.5. Swapping onto a regular file has no
> disadvantage wrt swapping onto a block device. The kernel does
> not need to allocate any memory at all to get a swapcache page
> onto disk.
>
> Which is interesting. Because swapfiles are much easier to
> administer,
> and much easier to stripe. Adding, removing and resizing is
> simplified.
> Distributors of 2.6-based kernels could consider doing away with
> swapdevs altogether.
Additionally, using a swapfile allows you to share swapspace with other
OSes.
This can be rather handy on a multibooting laptop with a small
harddrive.
I've done this successfully on a laptop multibooting RedHat 8.0 and
Windows XP. The procedure is quite simple:
- Set up the Windows swapfile on a FAT32 partition, it will preallocate
the file as pagefile.sys (up to the minimum size that you specify).
- Make sure the FAT32 partition gets mounted in /etc/fstab.
- mkswap the pagefile.sys file in the Linux bootscripts before
swapfiles are turned on (Windows will trash the Linux swap signature).
- Fortunately Windows will gladly use a swapfile trashed by Linux, so
there's no need to backup and restore any Windows swapfile headers.
One unfortunate disadvantage is that Windows hibernation to disk cannot
be used, since it assumes the contents of the pagefile are unmodified
when you resume.
Does anyone know if NTFS-TNG in 2.5 is robust enough to mount Windows XP
partitions and allow overwriting of existing files such as pagefile.sys?
If that is the case, the procedure is even easier because you can
eliminate the FAT32 partition and simply mount the main Windows XP
installation partition.
Troels
^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: [announce] swap mini-howto
2002-11-02 11:22 ` Troels Walsted Hansen
@ 2002-11-04 10:47 ` Richard Russon
0 siblings, 0 replies; 18+ messages in thread
From: Richard Russon @ 2002-11-04 10:47 UTC (permalink / raw)
To: Troels Walsted Hansen; +Cc: lkml, Anton Altaparmakov
Hi Troels,
> Does anyone know if NTFS-TNG in 2.5 is robust enough to mount Windows XP
> partitions and allow overwriting of existing files such as pagefile.sys?
Yes, this shouldn't be a problem.
Anton has successfully tested overwriting normal files (not compressed,
sparse or encrypted). This is possible with either write or mmap.
Cheers,
FlatCap (Rich)
ntfs@flatcap.org
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [announce] swap mini-howto
2002-11-02 0:46 ` Andrew Morton
2002-11-02 8:26 ` Jeff Garzik
2002-11-02 11:22 ` Troels Walsted Hansen
@ 2002-11-02 16:55 ` Pavel Machek
2002-11-02 21:23 ` Rik van Riel
2 siblings, 1 reply; 18+ messages in thread
From: Pavel Machek @ 2002-11-02 16:55 UTC (permalink / raw)
To: Andrew Morton; +Cc: Dave Jones, Randy.Dunlap, linux-kernel
Hi!
> That has changed in 2.5. Swapping onto a regular file has no
> disadvantage wrt swapping onto a block device. The kernel does
> not need to allocate any memory at all to get a swapcache page
> onto disk.
>
> Which is interesting. Because swapfiles are much easier to administer,
> and much easier to stripe. Adding, removing and resizing is simplified.
> Distributors of 2.6-based kernels could consider doing away with
> swapdevs altogether.
Well, you can swsusp to partition. You can't swsusp to a file, as that
is very hard to do.
Pavel
--
When do you have heart between your knees?
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [announce] swap mini-howto
2002-11-02 16:55 ` Pavel Machek
@ 2002-11-02 21:23 ` Rik van Riel
2002-11-02 21:28 ` Pavel Machek
0 siblings, 1 reply; 18+ messages in thread
From: Rik van Riel @ 2002-11-02 21:23 UTC (permalink / raw)
To: Pavel Machek; +Cc: Andrew Morton, Dave Jones, Randy.Dunlap, linux-kernel
On Sat, 2 Nov 2002, Pavel Machek wrote:
> > That has changed in 2.5. Swapping onto a regular file has no
> > disadvantage wrt swapping onto a block device. The kernel does
> > not need to allocate any memory at all to get a swapcache page
> > onto disk.
>
> Well, you can swsusp to partition. You can't swsusp to a file, as that
> is very hard to do.
Why is it very hard to do ?
For the swap layer, swap to a partition or to a file is the
same thing.
Does swsusp rely on restoring memory from the swap partition
before mounting the root filesystem or is there more behind
your objection ?
regards,
Rik
--
Bravely reimplemented by the knights who say "NIH".
http://www.surriel.com/ http://distro.conectiva.com/
Current spamtrap: <a href=mailto:"october@surriel.com">october@surriel.com</a>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [announce] swap mini-howto
2002-11-02 21:23 ` Rik van Riel
@ 2002-11-02 21:28 ` Pavel Machek
0 siblings, 0 replies; 18+ messages in thread
From: Pavel Machek @ 2002-11-02 21:28 UTC (permalink / raw)
To: Rik van Riel; +Cc: Andrew Morton, Dave Jones, Randy.Dunlap, linux-kernel
Hi!
> > > That has changed in 2.5. Swapping onto a regular file has no
> > > disadvantage wrt swapping onto a block device. The kernel does
> > > not need to allocate any memory at all to get a swapcache page
> > > onto disk.
> >
> > Well, you can swsusp to partition. You can't swsusp to a file, as that
> > is very hard to do.
>
> Why is it very hard to do ?
>
> For the swap layer, swap to a partition or to a file is the
> same thing.
>
> Does swsusp rely on restoring memory from the swap partition
> before mounting the root filesystem or is there more behind
> your objection ?
Yep, I rely on that.
[Even read-only mount of ext3 might cause journal replay, which means
data corruption. If there's real-read-only mode, resume-from-file
might be doable.
Pavel
--
Casualities in World Trade Center: ~3k dead inside the building,
cryptography in U.S.A. and free speech in Czech Republic.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [announce] swap mini-howto
2002-11-01 23:58 Randy.Dunlap
2002-11-02 0:09 ` Dave Jones
@ 2002-11-02 0:19 ` Andries Brouwer
2002-11-02 0:25 ` Randy.Dunlap
2002-11-02 1:01 ` Nicolas Pitre
2002-11-02 1:23 ` Bernd Eckenfels
3 siblings, 1 reply; 18+ messages in thread
From: Andries Brouwer @ 2002-11-02 0:19 UTC (permalink / raw)
To: Randy.Dunlap; +Cc: linux-kernel
On Fri, Nov 01, 2002 at 03:58:27PM -0800, Randy.Dunlap wrote:
> http://www.xenotime.net/linux/swap-mini-howto.txt
Maybe either refer to 'man mkswap' or add a sentence
about versions. (If you boot both 2.0 and 2.2 then
use mkswap -v0 to get swap space also 2.0 can use.)
Andries
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [announce] swap mini-howto
2002-11-02 0:19 ` Andries Brouwer
@ 2002-11-02 0:25 ` Randy.Dunlap
2002-11-02 11:19 ` Andries Brouwer
0 siblings, 1 reply; 18+ messages in thread
From: Randy.Dunlap @ 2002-11-02 0:25 UTC (permalink / raw)
To: Andries Brouwer; +Cc: linux-kernel
On Sat, 2 Nov 2002, Andries Brouwer wrote:
| On Fri, Nov 01, 2002 at 03:58:27PM -0800, Randy.Dunlap wrote:
|
| > http://www.xenotime.net/linux/swap-mini-howto.txt
|
| Maybe either refer to 'man mkswap' or add a sentence
| about versions. (If you boot both 2.0 and 2.2 then
| use mkswap -v0 to get swap space also 2.0 can use.)
Will do.
BTW, my current (maybe outdated?) mkswap.8 page says:
Presently, Linux allows 8 swap areas. The areas in use
can be seen in the file /proc/swaps (since 2.1.25).
However, the current (2.5) source code supports 32 swap areas.
I don't know when this was changed...
--
~Randy
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [announce] swap mini-howto
2002-11-02 0:25 ` Randy.Dunlap
@ 2002-11-02 11:19 ` Andries Brouwer
0 siblings, 0 replies; 18+ messages in thread
From: Andries Brouwer @ 2002-11-02 11:19 UTC (permalink / raw)
To: Randy.Dunlap; +Cc: linux-kernel
On Fri, Nov 01, 2002 at 04:25:33PM -0800, Randy.Dunlap wrote:
> BTW, my current (maybe outdated?) mkswap.8 page says:
> Presently, Linux allows 8 swap areas. The areas in use
> can be seen in the file /proc/swaps (since 2.1.25).
>
> However, the current (2.5) source code supports 32 swap areas.
> I don't know when this was changed...
It was changed in 2.4.10.
Andries
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [announce] swap mini-howto
2002-11-01 23:58 Randy.Dunlap
2002-11-02 0:09 ` Dave Jones
2002-11-02 0:19 ` Andries Brouwer
@ 2002-11-02 1:01 ` Nicolas Pitre
2002-11-02 1:23 ` Bernd Eckenfels
3 siblings, 0 replies; 18+ messages in thread
From: Nicolas Pitre @ 2002-11-02 1:01 UTC (permalink / raw)
To: Randy.Dunlap; +Cc: lkml
On Fri, 1 Nov 2002, Randy.Dunlap wrote:
>
> Anyone have suggestions for where this should/could live,
> like tldp.org or kernelnewbies.org etc.?
> (other than where it is :)
The Linux Documentation Project (www.linuxdoc.org) is probably one of the
best places. They gather all howto/mini-howto they can find.
Nicolas
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [announce] swap mini-howto
2002-11-01 23:58 Randy.Dunlap
` (2 preceding siblings ...)
2002-11-02 1:01 ` Nicolas Pitre
@ 2002-11-02 1:23 ` Bernd Eckenfels
3 siblings, 0 replies; 18+ messages in thread
From: Bernd Eckenfels @ 2002-11-02 1:23 UTC (permalink / raw)
To: linux-kernel
In article <Pine.LNX.4.33L2.0211011540140.28320-100000@dragon.pdx.osdl.net> you wrote:
> I'm sure that it has some things that need to be corrected,
You say that linux needs swap=ram and old linux needs swap=2xram which is
not true. There is no "need" for swap size (like in BSD where you need to
have at least as much swap as you have ram).
If your system is doing a lot of memory intense work you may need swap space
up to dozents of gigabyte :)
Normally it is enough to have 1-2 times of your ram, if you have a normal
128-1gb system.
Swap usage can be monitored with the "free" command.
> Anyone have suggestions for where this should/could live,
> like tldp.org or kernelnewbies.org etc.?
> (other than where it is :)
i would suggest you send it to the LDP (tldp.org) cause they will be
mirrored everywhere.
Greetings
Bernd
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2002-11-04 10:41 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-03 10:56 [announce] swap mini-howto Gabor MICSKO
-- strict thread matches above, loose matches on Subject: below --
2002-11-01 23:58 Randy.Dunlap
2002-11-02 0:09 ` Dave Jones
2002-11-02 0:07 ` Randy.Dunlap
2002-11-02 0:46 ` Andrew Morton
2002-11-02 8:26 ` Jeff Garzik
2002-11-02 10:02 ` Andrew Morton
2002-11-02 23:31 ` Jeff Garzik
2002-11-02 11:22 ` Troels Walsted Hansen
2002-11-04 10:47 ` Richard Russon
2002-11-02 16:55 ` Pavel Machek
2002-11-02 21:23 ` Rik van Riel
2002-11-02 21:28 ` Pavel Machek
2002-11-02 0:19 ` Andries Brouwer
2002-11-02 0:25 ` Randy.Dunlap
2002-11-02 11:19 ` Andries Brouwer
2002-11-02 1:01 ` Nicolas Pitre
2002-11-02 1:23 ` Bernd Eckenfels
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox