Re: Current Max Swap size? Performance issues

From: Andreas Dilger (adilger@turbolabs.com)
Date: Mon Nov 19 2001 - 04:48:56 EST


On Nov 17, 2001 23:28 -0700, Eric W. Biederman wrote:
> Andreas Dilger <adilger@turbolabs.com> 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/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Nov 23 2001 - 21:00:19 EST