diff options
Diffstat (limited to 'mm/hugetlb.c')
-rw-r--r-- | mm/hugetlb.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 0a0be33bb199..1a12f5b9a0ab 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -2124,8 +2124,12 @@ int hugetlb_report_node_meminfo(int nid, char *buf) | |||
2124 | /* Return the number pages of memory we physically have, in PAGE_SIZE units. */ | 2124 | /* Return the number pages of memory we physically have, in PAGE_SIZE units. */ |
2125 | unsigned long hugetlb_total_pages(void) | 2125 | unsigned long hugetlb_total_pages(void) |
2126 | { | 2126 | { |
2127 | struct hstate *h = &default_hstate; | 2127 | struct hstate *h; |
2128 | return h->nr_huge_pages * pages_per_huge_page(h); | 2128 | unsigned long nr_total_pages = 0; |
2129 | |||
2130 | for_each_hstate(h) | ||
2131 | nr_total_pages += h->nr_huge_pages * pages_per_huge_page(h); | ||
2132 | return nr_total_pages; | ||
2129 | } | 2133 | } |
2130 | 2134 | ||
2131 | static int hugetlb_acct_memory(struct hstate *h, long delta) | 2135 | static int hugetlb_acct_memory(struct hstate *h, long delta) |
@@ -2957,7 +2961,17 @@ long follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
2957 | break; | 2961 | break; |
2958 | } | 2962 | } |
2959 | 2963 | ||
2960 | if (absent || | 2964 | /* |
2965 | * We need call hugetlb_fault for both hugepages under migration | ||
2966 | * (in which case hugetlb_fault waits for the migration,) and | ||
2967 | * hwpoisoned hugepages (in which case we need to prevent the | ||
2968 | * caller from accessing to them.) In order to do this, we use | ||
2969 | * here is_swap_pte instead of is_hugetlb_entry_migration and | ||
2970 | * is_hugetlb_entry_hwpoisoned. This is because it simply covers | ||
2971 | * both cases, and because we can't follow correct pages | ||
2972 | * directly from any kind of swap entries. | ||
2973 | */ | ||
2974 | if (absent || is_swap_pte(huge_ptep_get(pte)) || | ||
2961 | ((flags & FOLL_WRITE) && !pte_write(huge_ptep_get(pte)))) { | 2975 | ((flags & FOLL_WRITE) && !pte_write(huge_ptep_get(pte)))) { |
2962 | int ret; | 2976 | int ret; |
2963 | 2977 | ||