diff options
author | Jon Tollefson <kniht@linux.vnet.ibm.com> | 2008-07-24 00:27:53 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-24 13:47:19 -0400 |
commit | ec4b2c0c8312d1118c2acd00c89988ecf955d5cc (patch) | |
tree | 279b4fe868e774b14689688779d6dad54456b09a | |
parent | 53ba51d21d6e048424ab8aadfebdb1f25ae07b60 (diff) |
powerpc: function to allocate gigantic hugepages
The 16G page locations have been saved during early boot in an array. The
alloc_bootmem_huge_page() function adds a page from here to the
huge_boot_pages list.
Acked-by: Adam Litke <agl@us.ibm.com>
Signed-off-by: Jon Tollefson <kniht@linux.vnet.ibm.com>
Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/powerpc/mm/hugetlbpage.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index 63db7adce717..5df82186fc93 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c | |||
@@ -29,6 +29,12 @@ | |||
29 | 29 | ||
30 | #define NUM_LOW_AREAS (0x100000000UL >> SID_SHIFT) | 30 | #define NUM_LOW_AREAS (0x100000000UL >> SID_SHIFT) |
31 | #define NUM_HIGH_AREAS (PGTABLE_RANGE >> HTLB_AREA_SHIFT) | 31 | #define NUM_HIGH_AREAS (PGTABLE_RANGE >> HTLB_AREA_SHIFT) |
32 | #define MAX_NUMBER_GPAGES 1024 | ||
33 | |||
34 | /* Tracks the 16G pages after the device tree is scanned and before the | ||
35 | * huge_boot_pages list is ready. */ | ||
36 | static unsigned long gpage_freearray[MAX_NUMBER_GPAGES]; | ||
37 | static unsigned nr_gpages; | ||
32 | 38 | ||
33 | unsigned int hugepte_shift; | 39 | unsigned int hugepte_shift; |
34 | #define PTRS_PER_HUGEPTE (1 << hugepte_shift) | 40 | #define PTRS_PER_HUGEPTE (1 << hugepte_shift) |
@@ -104,6 +110,21 @@ pmd_t *hpmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long addr) | |||
104 | } | 110 | } |
105 | #endif | 111 | #endif |
106 | 112 | ||
113 | /* Moves the gigantic page addresses from the temporary list to the | ||
114 | * huge_boot_pages list. */ | ||
115 | int alloc_bootmem_huge_page(struct hstate *h) | ||
116 | { | ||
117 | struct huge_bootmem_page *m; | ||
118 | if (nr_gpages == 0) | ||
119 | return 0; | ||
120 | m = phys_to_virt(gpage_freearray[--nr_gpages]); | ||
121 | gpage_freearray[nr_gpages] = 0; | ||
122 | list_add(&m->list, &huge_boot_pages); | ||
123 | m->hstate = h; | ||
124 | return 1; | ||
125 | } | ||
126 | |||
127 | |||
107 | /* Modelled after find_linux_pte() */ | 128 | /* Modelled after find_linux_pte() */ |
108 | pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) | 129 | pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) |
109 | { | 130 | { |