diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2005-06-21 20:14:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-21 21:46:15 -0400 |
commit | 63551ae0feaaa23807ebea60de1901564bbef32e (patch) | |
tree | f6f97f60f83c3e9813bdfcc6039c499997b1ea10 /include/linux/hugetlb.h | |
parent | 1e7e5a9048b30c57ba1ddaa6cdf59b21b65cde99 (diff) |
[PATCH] Hugepage consolidation
A lot of the code in arch/*/mm/hugetlbpage.c is quite similar. This patch
attempts to consolidate a lot of the code across the arch's, putting the
combined version in mm/hugetlb.c. There are a couple of uglyish hacks in
order to covert all the hugepage archs, but the result is a very large
reduction in the total amount of code. It also means things like hugepage
lazy allocation could be implemented in one place, instead of six.
Tested, at least a little, on ppc64, i386 and x86_64.
Notes:
- this patch changes the meaning of set_huge_pte() to be more
analagous to set_pte()
- does SH4 need s special huge_ptep_get_and_clear()??
Acked-by: William Lee Irwin <wli@holomorphy.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/hugetlb.h')
-rw-r--r-- | include/linux/hugetlb.h | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 6af1ae4a8211..f529d1442815 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #ifdef CONFIG_HUGETLB_PAGE | 4 | #ifdef CONFIG_HUGETLB_PAGE |
5 | 5 | ||
6 | #include <linux/mempolicy.h> | 6 | #include <linux/mempolicy.h> |
7 | #include <asm/tlbflush.h> | ||
7 | 8 | ||
8 | struct ctl_table; | 9 | struct ctl_table; |
9 | 10 | ||
@@ -22,12 +23,6 @@ int hugetlb_report_meminfo(char *); | |||
22 | int hugetlb_report_node_meminfo(int, char *); | 23 | int hugetlb_report_node_meminfo(int, char *); |
23 | int is_hugepage_mem_enough(size_t); | 24 | int is_hugepage_mem_enough(size_t); |
24 | unsigned long hugetlb_total_pages(void); | 25 | unsigned long hugetlb_total_pages(void); |
25 | struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address, | ||
26 | int write); | ||
27 | struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address, | ||
28 | pmd_t *pmd, int write); | ||
29 | int is_aligned_hugepage_range(unsigned long addr, unsigned long len); | ||
30 | int pmd_huge(pmd_t pmd); | ||
31 | struct page *alloc_huge_page(void); | 26 | struct page *alloc_huge_page(void); |
32 | void free_huge_page(struct page *); | 27 | void free_huge_page(struct page *); |
33 | 28 | ||
@@ -35,6 +30,17 @@ extern unsigned long max_huge_pages; | |||
35 | extern const unsigned long hugetlb_zero, hugetlb_infinity; | 30 | extern const unsigned long hugetlb_zero, hugetlb_infinity; |
36 | extern int sysctl_hugetlb_shm_group; | 31 | extern int sysctl_hugetlb_shm_group; |
37 | 32 | ||
33 | /* arch callbacks */ | ||
34 | |||
35 | pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr); | ||
36 | pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr); | ||
37 | struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address, | ||
38 | int write); | ||
39 | struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address, | ||
40 | pmd_t *pmd, int write); | ||
41 | int is_aligned_hugepage_range(unsigned long addr, unsigned long len); | ||
42 | int pmd_huge(pmd_t pmd); | ||
43 | |||
38 | #ifndef ARCH_HAS_HUGEPAGE_ONLY_RANGE | 44 | #ifndef ARCH_HAS_HUGEPAGE_ONLY_RANGE |
39 | #define is_hugepage_only_range(mm, addr, len) 0 | 45 | #define is_hugepage_only_range(mm, addr, len) 0 |
40 | #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) \ | 46 | #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) \ |
@@ -48,6 +54,28 @@ extern int sysctl_hugetlb_shm_group; | |||
48 | int prepare_hugepage_range(unsigned long addr, unsigned long len); | 54 | int prepare_hugepage_range(unsigned long addr, unsigned long len); |
49 | #endif | 55 | #endif |
50 | 56 | ||
57 | #ifndef ARCH_HAS_SETCLEAR_HUGE_PTE | ||
58 | #define set_huge_pte_at(mm, addr, ptep, pte) set_pte_at(mm, addr, ptep, pte) | ||
59 | #define huge_ptep_get_and_clear(mm, addr, ptep) ptep_get_and_clear(mm, addr, ptep) | ||
60 | #else | ||
61 | void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, | ||
62 | pte_t *ptep, pte_t pte); | ||
63 | pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, | ||
64 | pte_t *ptep); | ||
65 | #endif | ||
66 | |||
67 | #ifndef ARCH_HAS_HUGETLB_PREFAULT_HOOK | ||
68 | #define hugetlb_prefault_arch_hook(mm) do { } while (0) | ||
69 | #else | ||
70 | void hugetlb_prefault_arch_hook(struct mm_struct *mm); | ||
71 | #endif | ||
72 | |||
73 | #ifndef ARCH_HAS_HUGETLB_CLEAN_STALE_PGTABLE | ||
74 | #define hugetlb_clean_stale_pgtable(pte) BUG() | ||
75 | #else | ||
76 | void hugetlb_clean_stale_pgtable(pte_t *pte); | ||
77 | #endif | ||
78 | |||
51 | #else /* !CONFIG_HUGETLB_PAGE */ | 79 | #else /* !CONFIG_HUGETLB_PAGE */ |
52 | 80 | ||
53 | static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) | 81 | static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) |