aboutsummaryrefslogtreecommitdiffstats
path: root/mm/hugetlb.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/hugetlb.c')
-rw-r--r--mm/hugetlb.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 716465ae57aa..10de25cf1f99 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -40,6 +40,11 @@ int hugepages_treat_as_movable;
40int hugetlb_max_hstate __read_mostly; 40int hugetlb_max_hstate __read_mostly;
41unsigned int default_hstate_idx; 41unsigned int default_hstate_idx;
42struct hstate hstates[HUGE_MAX_HSTATE]; 42struct hstate hstates[HUGE_MAX_HSTATE];
43/*
44 * Minimum page order among possible hugepage sizes, set to a proper value
45 * at boot time.
46 */
47static unsigned int minimum_order __read_mostly = UINT_MAX;
43 48
44__initdata LIST_HEAD(huge_boot_pages); 49__initdata LIST_HEAD(huge_boot_pages);
45 50
@@ -1188,19 +1193,13 @@ static void dissolve_free_huge_page(struct page *page)
1188 */ 1193 */
1189void dissolve_free_huge_pages(unsigned long start_pfn, unsigned long end_pfn) 1194void dissolve_free_huge_pages(unsigned long start_pfn, unsigned long end_pfn)
1190{ 1195{
1191 unsigned int order = 8 * sizeof(void *);
1192 unsigned long pfn; 1196 unsigned long pfn;
1193 struct hstate *h;
1194 1197
1195 if (!hugepages_supported()) 1198 if (!hugepages_supported())
1196 return; 1199 return;
1197 1200
1198 /* Set scan step to minimum hugepage size */ 1201 VM_BUG_ON(!IS_ALIGNED(start_pfn, 1 << minimum_order));
1199 for_each_hstate(h) 1202 for (pfn = start_pfn; pfn < end_pfn; pfn += 1 << minimum_order)
1200 if (order > huge_page_order(h))
1201 order = huge_page_order(h);
1202 VM_BUG_ON(!IS_ALIGNED(start_pfn, 1 << order));
1203 for (pfn = start_pfn; pfn < end_pfn; pfn += 1 << order)
1204 dissolve_free_huge_page(pfn_to_page(pfn)); 1203 dissolve_free_huge_page(pfn_to_page(pfn));
1205} 1204}
1206 1205
@@ -1627,10 +1626,14 @@ static void __init hugetlb_init_hstates(void)
1627 struct hstate *h; 1626 struct hstate *h;
1628 1627
1629 for_each_hstate(h) { 1628 for_each_hstate(h) {
1629 if (minimum_order > huge_page_order(h))
1630 minimum_order = huge_page_order(h);
1631
1630 /* oversize hugepages were init'ed in early boot */ 1632 /* oversize hugepages were init'ed in early boot */
1631 if (!hstate_is_gigantic(h)) 1633 if (!hstate_is_gigantic(h))
1632 hugetlb_hstate_alloc_pages(h); 1634 hugetlb_hstate_alloc_pages(h);
1633 } 1635 }
1636 VM_BUG_ON(minimum_order == UINT_MAX);
1634} 1637}
1635 1638
1636static char * __init memfmt(char *buf, unsigned long n) 1639static char * __init memfmt(char *buf, unsigned long n)