include/linux/nodemask.h: create next_node_in() helper
[linux-2.6-block.git] / mm / page_isolation.c
index c4f568206544b616969d59631017d51da0d46a85..67bedd18429cabe0f874e719326f0a6175c0aef3 100644 (file)
@@ -288,13 +288,10 @@ struct page *alloc_migrate_target(struct page *page, unsigned long private,
         * accordance with memory policy of the user process if possible. For
         * now as a simple work-around, we use the next node for destination.
         */
-       if (PageHuge(page)) {
-               int node = next_online_node(page_to_nid(page));
-               if (node == MAX_NUMNODES)
-                       node = first_online_node;
+       if (PageHuge(page))
                return alloc_huge_page_node(page_hstate(compound_head(page)),
-                                           node);
-       }
+                                           next_node_in(page_to_nid(page),
+                                                        node_online_map));
 
        if (PageHighMem(page))
                gfp_mask |= __GFP_HIGHMEM;