page allocator: use a pre-calculated value instead of num_online_nodes() in fast...
[firefly-linux-kernel-4.4.55.git] / mm / hugetlb.c
index e83ad2c9228c1242a582920c3a03b691f5dd56f9..7b9b6015b2ecaee62be67c380f09b3dc471d5c3e 100644 (file)
@@ -630,7 +630,7 @@ static struct page *alloc_fresh_huge_page_node(struct hstate *h, int nid)
        if (h->order >= MAX_ORDER)
                return NULL;
 
-       page = alloc_pages_node(nid,
+       page = alloc_pages_exact_node(nid,
                htlb_alloc_mask|__GFP_COMP|__GFP_THISNODE|
                                                __GFP_REPEAT|__GFP_NOWARN,
                huge_page_order(h));
@@ -649,7 +649,7 @@ static struct page *alloc_fresh_huge_page_node(struct hstate *h, int nid)
  * Use a helper variable to find the next node and then
  * copy it back to hugetlb_next_nid afterwards:
  * otherwise there's a window in which a racer might
- * pass invalid nid MAX_NUMNODES to alloc_pages_node.
+ * pass invalid nid MAX_NUMNODES to alloc_pages_exact_node.
  * But we don't need to use a spin_lock here: it really
  * doesn't matter if occasionally a racer chooses the
  * same nid as we do.  Move nid forward in the mask even
@@ -875,7 +875,7 @@ static void return_unused_surplus_pages(struct hstate *h,
         * can no longer free unreserved surplus pages. This occurs when
         * the nodes with surplus pages have no free pages.
         */
-       unsigned long remaining_iterations = num_online_nodes();
+       unsigned long remaining_iterations = nr_online_nodes;
 
        /* Uncommit the reservation */
        h->resv_huge_pages -= unused_resv_pages;
@@ -904,7 +904,7 @@ static void return_unused_surplus_pages(struct hstate *h,
                        h->surplus_huge_pages--;
                        h->surplus_huge_pages_node[nid]--;
                        nr_pages--;
-                       remaining_iterations = num_online_nodes();
+                       remaining_iterations = nr_online_nodes;
                }
        }
 }