{
        int i;
 
-       VM_BUG_ON(h->order >= MAX_ORDER);
+       VM_BUG_ON(hstate_is_gigantic(h));
 
        h->nr_huge_pages--;
        h->nr_huge_pages_node[page_to_nid(page)]--;
        if (restore_reserve)
                h->resv_huge_pages++;
 
-       if (h->surplus_huge_pages_node[nid] && huge_page_order(h) < MAX_ORDER) {
+       if (h->surplus_huge_pages_node[nid] && !hstate_is_gigantic(h)) {
                /* remove the page from active list */
                list_del(&page->lru);
                update_and_free_page(h, page);
 {
        struct page *page;
 
-       if (h->order >= MAX_ORDER)
+       if (hstate_is_gigantic(h))
                return NULL;
 
        page = alloc_pages_exact_node(nid,
        struct page *page;
        unsigned int r_nid;
 
-       if (h->order >= MAX_ORDER)
+       if (hstate_is_gigantic(h))
                return NULL;
 
        /*
        h->resv_huge_pages -= unused_resv_pages;
 
        /* Cannot return gigantic pages currently */
-       if (h->order >= MAX_ORDER)
+       if (hstate_is_gigantic(h))
                return;
 
        nr_pages = min(unused_resv_pages, h->surplus_huge_pages);
                 * fix confusing memory reports from free(1) and another
                 * side-effects, like CommitLimit going negative.
                 */
-               if (h->order > (MAX_ORDER - 1))
+               if (hstate_is_gigantic(h))
                        adjust_managed_page_count(page, 1 << h->order);
        }
 }
        unsigned long i;
 
        for (i = 0; i < h->max_huge_pages; ++i) {
-               if (h->order >= MAX_ORDER) {
+               if (hstate_is_gigantic(h)) {
                        if (!alloc_bootmem_huge_page(h))
                                break;
                } else if (!alloc_fresh_huge_page(h,
 
        for_each_hstate(h) {
                /* oversize hugepages were init'ed in early boot */
-               if (h->order < MAX_ORDER)
+               if (!hstate_is_gigantic(h))
                        hugetlb_hstate_alloc_pages(h);
        }
 }
 {
        int i;
 
-       if (h->order >= MAX_ORDER)
+       if (hstate_is_gigantic(h))
                return;
 
        for_each_node_mask(i, *nodes_allowed) {
 {
        unsigned long min_count, ret;
 
-       if (h->order >= MAX_ORDER)
+       if (hstate_is_gigantic(h))
                return h->max_huge_pages;
 
        /*
                goto out;
 
        h = kobj_to_hstate(kobj, &nid);
-       if (h->order >= MAX_ORDER) {
+       if (hstate_is_gigantic(h)) {
                err = -EINVAL;
                goto out;
        }
        unsigned long input;
        struct hstate *h = kobj_to_hstate(kobj, NULL);
 
-       if (h->order >= MAX_ORDER)
+       if (hstate_is_gigantic(h))
                return -EINVAL;
 
        err = kstrtoul(buf, 10, &input);
 
        tmp = h->max_huge_pages;
 
-       if (write && h->order >= MAX_ORDER)
+       if (write && hstate_is_gigantic(h))
                return -EINVAL;
 
        table->data = &tmp;
 
        tmp = h->nr_overcommit_huge_pages;
 
-       if (write && h->order >= MAX_ORDER)
+       if (write && hstate_is_gigantic(h))
                return -EINVAL;
 
        table->data = &tmp;