From 93ff334616e5c841afdfc795362b03a7b4ec664c Mon Sep 17 00:00:00 2001 From: William Lee Irwin III Date: Mon, 23 Aug 2004 21:28:07 -0700 Subject: [PATCH] [PATCH] x86 PAE swapspace expansion PAE is artificially limited in terms of swapspace to the same bitsplit as ordinary i386, a 5/24 split (32 swapfiles, 64GB max swapfile size), when a 5/27 split (32 swapfiles, 512GB max swapfile size) is feasible. This patch transparently removes that limitation by using more of the space available in PAE's wider ptes for swap ptes. While this is obviously not likely to be used directly, it is important from the standpoint of strict non-overcommit, where the swapspace must be potentially usable in order to be reserved for non-overcommit. There are workloads with Committed_AS of over 256GB on ia32 PAE wanting strict non-overcommit to prevent being OOM killed. Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-i386/pgtable-2level.h | 7 +++++++ include/asm-i386/pgtable-3level.h | 7 +++++++ include/asm-i386/pgtable.h | 7 ------- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/include/asm-i386/pgtable-2level.h b/include/asm-i386/pgtable-2level.h index de51110560b9d..58867b62f47b4 100644 --- a/include/asm-i386/pgtable-2level.h +++ b/include/asm-i386/pgtable-2level.h @@ -75,4 +75,11 @@ static inline int pte_exec_kernel(pte_t pte) #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 }) + #endif /* _I386_PGTABLE_2LEVEL_H */ diff --git a/include/asm-i386/pgtable-3level.h b/include/asm-i386/pgtable-3level.h index d78e3493da720..e48ab3d07c834 100644 --- a/include/asm-i386/pgtable-3level.h +++ b/include/asm-i386/pgtable-3level.h @@ -134,4 +134,11 @@ static inline pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot) #define pgoff_to_pte(off) ((pte_t) { _PAGE_FILE, (off) }) #define PTE_FILE_MAX_BITS 32 +/* Encode and de-code a swap entry */ +#define __swp_type(x) (((x).val) & 0x1f) +#define __swp_offset(x) ((x).val >> 5) +#define __swp_entry(type, offset) ((swp_entry_t){(type) | (offset) << 5}) +#define __pte_to_swp_entry(pte) ((swp_entry_t){ (pte).pte_high }) +#define __swp_entry_to_pte(x) ((pte_t){ 0, (x).val }) + #endif /* _I386_PGTABLE_3LEVEL_H */ diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h index 8f9fcab61f5cc..b4ba1fd6f99dc 100644 --- a/include/asm-i386/pgtable.h +++ b/include/asm-i386/pgtable.h @@ -398,13 +398,6 @@ extern pte_t *lookup_address(unsigned long address); } \ } while (0) -/* 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 }) - #endif /* !__ASSEMBLY__ */ #ifndef CONFIG_DISCONTIGMEM -- 2.53.0