2001-11-16 21:57:22

by Michael Peddemors

[permalink] [raw]
Subject: Current Max Swap size? Performance issues

With all of the latest VM, again the question is asked... Best way to
set up swap now..

For 2 GIG memory...
Channel 0 is RAID 1 SCSI
Channel 2 is RAID 1+0 SCSI
Hardware Raid

Shoudl it be?

2 GIG swap partition (Is this still the limit?)
Dual 2 GIG swaps on seperate channels?
Dual 2 GIG swap files on same channel?
(Assuming that the channel is different than the channel using the bulk
of I/O)

--
"Catch the Magic of Linux..."
--------------------------------------------------------
Michael Peddemors - Senior Consultant
LinuxAdministration - Internet Services
NetworkServices - Programming - Security
Wizard IT Services http://www.wizard.ca
Linux Support Specialist - http://www.linuxmagic.com
--------------------------------------------------------
(604)589-0037 Beautiful British Columbia, Canada


2001-11-16 23:35:37

by Andreas Dilger

[permalink] [raw]
Subject: Re: Current Max Swap size? Performance issues

On Nov 16, 2001 14:02 -0800, Michael Peddemors wrote:
> With all of the latest VM, again the question is asked... Best way to
> set up swap now..
>
> For 2 GIG memory...
> Channel 0 is RAID 1 SCSI
> Channel 2 is RAID 1+0 SCSI
> Hardware Raid
>
> Shoudl it be?
>
> 2 GIG swap partition (Is this still the limit?)

Yes, still the limit. It turns out that this is not an on-disk format
limit, but rather an in-memory structure limit, in case you cared. For
non-x86 platforms, there is a different limit.

> Dual 2 GIG swaps on seperate channels?
> Dual 2 GIG swap files on same channel?
> (Assuming that the channel is different than the channel using the bulk
> of I/O)

Well, if you have the hardware for it, obviously separate channels will
be better, as long as you don't get a lot of I/O contention. If you
put them on the same channel, but different disks, you still will get
some speedup if the swaps are equal priority. If they are sharing the
same disk, make sure you have different priorities for the swaps, so
that one gets filled before the other, or you will get a LOT of seeking
going on.

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/

2001-11-18 06:48:13

by Eric W. Biederman

[permalink] [raw]
Subject: Re: Current Max Swap size? Performance issues

Andreas Dilger <[email protected]> writes:

> On Nov 16, 2001 14:02 -0800, Michael Peddemors wrote:
> > With all of the latest VM, again the question is asked... Best way to
> > set up swap now..
> >
> > For 2 GIG memory...
> > Channel 0 is RAID 1 SCSI
> > Channel 2 is RAID 1+0 SCSI
> > Hardware Raid
> >
> > Shoudl it be?
> >
> > 2 GIG swap partition (Is this still the limit?)
>
> Yes, still the limit. It turns out that this is not an on-disk format
> limit, but rather an in-memory structure limit, in case you cared. For
> non-x86 platforms, there is a different limit.

Where? The limit should be about 64GB or so on x86. If it isn't it should
be just a couple of lines to change it. Or is the limit the vmalloc
of the swap_map?

I skimmed the code a while ago but I haven't had the time to patch mkswap
and actually try it with something larger.


Eric

2001-11-19 09:50:24

by Andreas Dilger

[permalink] [raw]
Subject: Re: Current Max Swap size? Performance issues

On Nov 17, 2001 23:28 -0700, Eric W. Biederman wrote:
> Andreas Dilger <[email protected]> writes:
> > > 2 GIG swap partition (Is this still the limit?)
> >
> > Yes, still the limit. It turns out that this is not an on-disk format
> > limit, but rather an in-memory structure limit, in case you cared. For
> > non-x86 platforms, there is a different limit.
>
> Where? The limit should be about 64GB or so on x86. If it isn't it should
> be just a couple of lines to change it. Or is the limit the vmalloc
> of the swap_map?

In my mm/swapfile.c code, I added comments about this, when I was adding
support for LABELs in swapfiles. The new swapfile limits say:

/* The new swap format has a page count and a list of page
* numbers which overlap bad blocks on disk. We are limited
* to 2^32 pages by the on-disk format (info.last_page and
* page numbers in badpages are both unsigned ints, 16TiB for
* 4kiB pages). We are also limited by SWP_ENTRY() which
* varies by architecture (64GiB for ia32).
*/
maxpages = SWP_OFFSET(SWP_ENTRY(0,~0UL)) - 1;

and include/asm-i386/pgtable.h has:
#define SWP_TYPE(x) (((x).val >> 1) & 0x3f)
#define SWP_OFFSET(x) ((x).val >> 8)
#define SWP_ENTRY(type, offset) ((swp_entry_t){((type) << 1) | ((offset) << 8)})


So, we are limited to 2^24 pages of swap from a single swapfile, and 4kB
pages (2^12), so 2^36 bytes of swap, which would be 64GB per swapfile.

Hmm, this means I don't know where the 2GB limit comes from. If we look
at the vmalloc of maxpages, we have 2x maxpages, so 2^25, or 32MB allocated
for a 64GB swapfile. I don't know if that would be a problem. For a
2GB swapfile, that would only be 1MB for the swap_map allocation.

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/