diff options
| -rw-r--r-- | Documentation/kernel-parameters.txt | 7 | ||||
| -rw-r--r-- | arch/x86/include/asm/pgalloc.h | 5 | ||||
| -rw-r--r-- | arch/x86/mm/pgtable.c | 31 |
3 files changed, 38 insertions, 5 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 736d45602886..67c69ffe7b7f 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
| @@ -2694,6 +2694,13 @@ and is between 256 and 4096 characters. It is defined in the file | |||
| 2694 | medium is write-protected). | 2694 | medium is write-protected). |
| 2695 | Example: quirks=0419:aaf5:rl,0421:0433:rc | 2695 | Example: quirks=0419:aaf5:rl,0421:0433:rc |
| 2696 | 2696 | ||
| 2697 | userpte= | ||
| 2698 | [X86] Flags controlling user PTE allocations. | ||
| 2699 | |||
| 2700 | nohigh = do not allocate PTE pages in | ||
| 2701 | HIGHMEM regardless of setting | ||
| 2702 | of CONFIG_HIGHPTE. | ||
| 2703 | |||
| 2697 | vdso= [X86,SH] | 2704 | vdso= [X86,SH] |
| 2698 | vdso=2: enable compat VDSO (default with COMPAT_VDSO) | 2705 | vdso=2: enable compat VDSO (default with COMPAT_VDSO) |
| 2699 | vdso=1: enable VDSO (default) | 2706 | vdso=1: enable VDSO (default) |
diff --git a/arch/x86/include/asm/pgalloc.h b/arch/x86/include/asm/pgalloc.h index 0e8c2a0fd922..271de94c3810 100644 --- a/arch/x86/include/asm/pgalloc.h +++ b/arch/x86/include/asm/pgalloc.h | |||
| @@ -23,6 +23,11 @@ static inline void paravirt_release_pud(unsigned long pfn) {} | |||
| 23 | #endif | 23 | #endif |
| 24 | 24 | ||
| 25 | /* | 25 | /* |
| 26 | * Flags to use when allocating a user page table page. | ||
| 27 | */ | ||
| 28 | extern gfp_t __userpte_alloc_gfp; | ||
| 29 | |||
| 30 | /* | ||
| 26 | * Allocate and free page tables. | 31 | * Allocate and free page tables. |
| 27 | */ | 32 | */ |
| 28 | extern pgd_t *pgd_alloc(struct mm_struct *); | 33 | extern pgd_t *pgd_alloc(struct mm_struct *); |
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c index ed34f5e35999..c9ba9deafe83 100644 --- a/arch/x86/mm/pgtable.c +++ b/arch/x86/mm/pgtable.c | |||
| @@ -6,6 +6,14 @@ | |||
| 6 | 6 | ||
| 7 | #define PGALLOC_GFP GFP_KERNEL | __GFP_NOTRACK | __GFP_REPEAT | __GFP_ZERO | 7 | #define PGALLOC_GFP GFP_KERNEL | __GFP_NOTRACK | __GFP_REPEAT | __GFP_ZERO |
| 8 | 8 | ||
| 9 | #ifdef CONFIG_HIGHPTE | ||
| 10 | #define PGALLOC_USER_GFP __GFP_HIGHMEM | ||
| 11 | #else | ||
| 12 | #define PGALLOC_USER_GFP 0 | ||
| 13 | #endif | ||
| 14 | |||
| 15 | gfp_t __userpte_alloc_gfp = PGALLOC_GFP | PGALLOC_USER_GFP; | ||
| 16 | |||
| 9 | pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) | 17 | pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) |
| 10 | { | 18 | { |
| 11 | return (pte_t *)__get_free_page(PGALLOC_GFP); | 19 | return (pte_t *)__get_free_page(PGALLOC_GFP); |
| @@ -15,16 +23,29 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address) | |||
| 15 | { | 23 | { |
| 16 | struct page *pte; | 24 | struct page *pte; |
| 17 | 25 | ||
| 18 | #ifdef CONFIG_HIGHPTE | 26 | pte = alloc_pages(__userpte_alloc_gfp, 0); |
| 19 | pte = alloc_pages(PGALLOC_GFP | __GFP_HIGHMEM, 0); | ||
| 20 | #else | ||
| 21 | pte = alloc_pages(PGALLOC_GFP, 0); | ||
| 22 | #endif | ||
| 23 | if (pte) | 27 | if (pte) |
| 24 | pgtable_page_ctor(pte); | 28 | pgtable_page_ctor(pte); |
| 25 | return pte; | 29 | return pte; |
| 26 | } | 30 | } |
| 27 | 31 | ||
| 32 | static int __init setup_userpte(char *arg) | ||
| 33 | { | ||
| 34 | if (!arg) | ||
| 35 | return -EINVAL; | ||
| 36 | |||
| 37 | /* | ||
| 38 | * "userpte=nohigh" disables allocation of user pagetables in | ||
| 39 | * high memory. | ||
| 40 | */ | ||
| 41 | if (strcmp(arg, "nohigh") == 0) | ||
| 42 | __userpte_alloc_gfp &= ~__GFP_HIGHMEM; | ||
| 43 | else | ||
| 44 | return -EINVAL; | ||
| 45 | return 0; | ||
| 46 | } | ||
| 47 | early_param("userpte", setup_userpte); | ||
| 48 | |||
| 28 | void ___pte_free_tlb(struct mmu_gather *tlb, struct page *pte) | 49 | void ___pte_free_tlb(struct mmu_gather *tlb, struct page *pte) |
| 29 | { | 50 | { |
| 30 | pgtable_page_dtor(pte); | 51 | pgtable_page_dtor(pte); |
