diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-28 13:38:45 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-28 13:38:45 -0500 |
| commit | 46bbffad54bd48bb809f2691c1970a79a588976b (patch) | |
| tree | 21779a574f118b1cba5d6832bc0a0fa3bee97075 /arch/x86/mm/pgtable.c | |
| parent | 85fe20bfd415af0a2e93bd1166533d4a6eb591ea (diff) | |
| parent | c1fd1b43831fa20c91cdd461342af8edf2e87c2f (diff) | |
Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
x86, mm: Unify kernel_physical_mapping_init() API
x86, mm: Allow highmem user page tables to be disabled at boot time
x86: Do not reserve brk for DMI if it's not going to be used
x86: Convert tlbstate_lock to raw_spinlock
x86: Use the generic page_is_ram()
x86: Remove BIOS data range from e820
Move page_is_ram() declaration to mm.h
Generic page_is_ram: use __weak
resources: introduce generic page_is_ram()
Diffstat (limited to 'arch/x86/mm/pgtable.c')
| -rw-r--r-- | arch/x86/mm/pgtable.c | 31 |
1 files changed, 26 insertions, 5 deletions
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); |
