aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2014-06-04 19:07:08 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-04 19:53:59 -0400
commitbae7f4ae14d47008a11b4358b167cb0ae186c06a (patch)
treefd5594eddfb5b249b67f2704032f3dda209f247e /mm
parent2906dd52831b6049e1d4d9b12f6f234bf2f64a03 (diff)
hugetlb: add hstate_is_gigantic()
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Andrea Arcangeli <aarcange@redhat.com> Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> Reviewed-by: Davidlohr Bueso <davidlohr@hp.com> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Reviewed-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Cc: David Rientjes <rientjes@google.com> Cc: Marcelo Tosatti <mtosatti@redhat.com> Cc: Rik van Riel <riel@redhat.com> Cc: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/hugetlb.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 5d54d4b8df01..a66310586894 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -611,7 +611,7 @@ static void update_and_free_page(struct hstate *h, struct page *page)
611{ 611{
612 int i; 612 int i;
613 613
614 VM_BUG_ON(h->order >= MAX_ORDER); 614 VM_BUG_ON(hstate_is_gigantic(h));
615 615
616 h->nr_huge_pages--; 616 h->nr_huge_pages--;
617 h->nr_huge_pages_node[page_to_nid(page)]--; 617 h->nr_huge_pages_node[page_to_nid(page)]--;
@@ -664,7 +664,7 @@ static void free_huge_page(struct page *page)
664 if (restore_reserve) 664 if (restore_reserve)
665 h->resv_huge_pages++; 665 h->resv_huge_pages++;
666 666
667 if (h->surplus_huge_pages_node[nid] && huge_page_order(h) < MAX_ORDER) { 667 if (h->surplus_huge_pages_node[nid] && !hstate_is_gigantic(h)) {
668 /* remove the page from active list */ 668 /* remove the page from active list */
669 list_del(&page->lru); 669 list_del(&page->lru);
670 update_and_free_page(h, page); 670 update_and_free_page(h, page);
@@ -768,7 +768,7 @@ static struct page *alloc_fresh_huge_page_node(struct hstate *h, int nid)
768{ 768{
769 struct page *page; 769 struct page *page;
770 770
771 if (h->order >= MAX_ORDER) 771 if (hstate_is_gigantic(h))
772 return NULL; 772 return NULL;
773 773
774 page = alloc_pages_exact_node(nid, 774 page = alloc_pages_exact_node(nid,
@@ -962,7 +962,7 @@ static struct page *alloc_buddy_huge_page(struct hstate *h, int nid)
962 struct page *page; 962 struct page *page;
963 unsigned int r_nid; 963 unsigned int r_nid;
964 964
965 if (h->order >= MAX_ORDER) 965 if (hstate_is_gigantic(h))
966 return NULL; 966 return NULL;
967 967
968 /* 968 /*
@@ -1155,7 +1155,7 @@ static void return_unused_surplus_pages(struct hstate *h,
1155 h->resv_huge_pages -= unused_resv_pages; 1155 h->resv_huge_pages -= unused_resv_pages;
1156 1156
1157 /* Cannot return gigantic pages currently */ 1157 /* Cannot return gigantic pages currently */
1158 if (h->order >= MAX_ORDER) 1158 if (hstate_is_gigantic(h))
1159 return; 1159 return;
1160 1160
1161 nr_pages = min(unused_resv_pages, h->surplus_huge_pages); 1161 nr_pages = min(unused_resv_pages, h->surplus_huge_pages);
@@ -1355,7 +1355,7 @@ static void __init gather_bootmem_prealloc(void)
1355 * fix confusing memory reports from free(1) and another 1355 * fix confusing memory reports from free(1) and another
1356 * side-effects, like CommitLimit going negative. 1356 * side-effects, like CommitLimit going negative.
1357 */ 1357 */
1358 if (h->order > (MAX_ORDER - 1)) 1358 if (hstate_is_gigantic(h))
1359 adjust_managed_page_count(page, 1 << h->order); 1359 adjust_managed_page_count(page, 1 << h->order);
1360 } 1360 }
1361} 1361}
@@ -1365,7 +1365,7 @@ static void __init hugetlb_hstate_alloc_pages(struct hstate *h)
1365 unsigned long i; 1365 unsigned long i;
1366 1366
1367 for (i = 0; i < h->max_huge_pages; ++i) { 1367 for (i = 0; i < h->max_huge_pages; ++i) {
1368 if (h->order >= MAX_ORDER) { 1368 if (hstate_is_gigantic(h)) {
1369 if (!alloc_bootmem_huge_page(h)) 1369 if (!alloc_bootmem_huge_page(h))
1370 break; 1370 break;
1371 } else if (!alloc_fresh_huge_page(h, 1371 } else if (!alloc_fresh_huge_page(h,
@@ -1381,7 +1381,7 @@ static void __init hugetlb_init_hstates(void)
1381 1381
1382 for_each_hstate(h) { 1382 for_each_hstate(h) {
1383 /* oversize hugepages were init'ed in early boot */ 1383 /* oversize hugepages were init'ed in early boot */
1384 if (h->order < MAX_ORDER) 1384 if (!hstate_is_gigantic(h))
1385 hugetlb_hstate_alloc_pages(h); 1385 hugetlb_hstate_alloc_pages(h);
1386 } 1386 }
1387} 1387}
@@ -1415,7 +1415,7 @@ static void try_to_free_low(struct hstate *h, unsigned long count,
1415{ 1415{
1416 int i; 1416 int i;
1417 1417
1418 if (h->order >= MAX_ORDER) 1418 if (hstate_is_gigantic(h))
1419 return; 1419 return;
1420 1420
1421 for_each_node_mask(i, *nodes_allowed) { 1421 for_each_node_mask(i, *nodes_allowed) {
@@ -1478,7 +1478,7 @@ static unsigned long set_max_huge_pages(struct hstate *h, unsigned long count,
1478{ 1478{
1479 unsigned long min_count, ret; 1479 unsigned long min_count, ret;
1480 1480
1481 if (h->order >= MAX_ORDER) 1481 if (hstate_is_gigantic(h))
1482 return h->max_huge_pages; 1482 return h->max_huge_pages;
1483 1483
1484 /* 1484 /*
@@ -1605,7 +1605,7 @@ static ssize_t nr_hugepages_store_common(bool obey_mempolicy,
1605 goto out; 1605 goto out;
1606 1606
1607 h = kobj_to_hstate(kobj, &nid); 1607 h = kobj_to_hstate(kobj, &nid);
1608 if (h->order >= MAX_ORDER) { 1608 if (hstate_is_gigantic(h)) {
1609 err = -EINVAL; 1609 err = -EINVAL;
1610 goto out; 1610 goto out;
1611 } 1611 }
@@ -1688,7 +1688,7 @@ static ssize_t nr_overcommit_hugepages_store(struct kobject *kobj,
1688 unsigned long input; 1688 unsigned long input;
1689 struct hstate *h = kobj_to_hstate(kobj, NULL); 1689 struct hstate *h = kobj_to_hstate(kobj, NULL);
1690 1690
1691 if (h->order >= MAX_ORDER) 1691 if (hstate_is_gigantic(h))
1692 return -EINVAL; 1692 return -EINVAL;
1693 1693
1694 err = kstrtoul(buf, 10, &input); 1694 err = kstrtoul(buf, 10, &input);
@@ -2112,7 +2112,7 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy,
2112 2112
2113 tmp = h->max_huge_pages; 2113 tmp = h->max_huge_pages;
2114 2114
2115 if (write && h->order >= MAX_ORDER) 2115 if (write && hstate_is_gigantic(h))
2116 return -EINVAL; 2116 return -EINVAL;
2117 2117
2118 table->data = &tmp; 2118 table->data = &tmp;
@@ -2168,7 +2168,7 @@ int hugetlb_overcommit_handler(struct ctl_table *table, int write,
2168 2168
2169 tmp = h->nr_overcommit_huge_pages; 2169 tmp = h->nr_overcommit_huge_pages;
2170 2170
2171 if (write && h->order >= MAX_ORDER) 2171 if (write && hstate_is_gigantic(h))
2172 return -EINVAL; 2172 return -EINVAL;
2173 2173
2174 table->data = &tmp; 2174 table->data = &tmp;