linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Lameter <clameter@sgi.com>
To: Eriberto <eriberto@eriberto.pro.br>
Cc: linux-mm@kvack.org
Subject: Re: swap: which is the maximum size allowed?
Date: Mon, 29 Jan 2007 12:02:23 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0701291157490.32345@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <epliuf$an7$1@sea.gmane.org>

On Mon, 29 Jan 2007, Eriberto wrote:

> I am trying understand the swap. I would like to know which is the
> maximum swap size on i386. Is 64 GB? If yes, how to know the origin of
> this "magic" number? How to calculate it? I don't found it (Internet).

If you look at include/asm-i386/pgtable-2level.h


/*
 * Bits 0, 6 and 7 are taken, split up the 29 bits of offset
 * into this range:
 */
#define PTE_FILE_MAX_BITS       29

#define pte_to_pgoff(pte) \
        ((((pte).pte_low >> 1) & 0x1f ) + (((pte).pte_low >> 8) << 5 ))

#define pgoff_to_pte(off) \
        ((pte_t) { (((off) & 0x1f) << 1) + (((off) >> 5) << 8) + 
_PAGE_FILE })

/* Encode and de-code a swap entry */
#define __swp_type(x)                   (((x).val >> 1) & 0x1f)
#define __swp_offset(x)                 ((x).val >> 8)
#define __swp_entry(type, offset)       ((swp_entry_t) { ((type) << 1) | 
((offset) << 8) })
#define __pte_to_swp_entry(pte)         ((swp_entry_t) { (pte).pte_low })
#define __swp_entry_to_pte(x)           ((pte_t) { (x).val })

5 bits are used for the swap file number (__swp_type). This gives you 32 
swap fileswith 2^(29-5)*PAGE_SIZE = 64 GB each.

The swap size is bigger if you use 3 page table levels.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2007-01-29 20:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-29 19:46 swap: which is the maximum size allowed? Eriberto
2007-01-29 20:02 ` Christoph Lameter [this message]

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=Pine.LNX.4.64.0701291157490.32345@schroedinger.engr.sgi.com \
    --to=clameter@sgi.com \
    --cc=eriberto@eriberto.pro.br \
    --cc=linux-mm@kvack.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;
as well as URLs for NNTP newsgroup(s).