hugetlb: Add hugetlb_dynamic_pool sysctl
[linux-2.6.git] / mm / hugetlb.c
index 31bbca6b2c9099a9f6bb9612a8f7e772a1023e7d..efd78527ad1ee62159d8955069756fdaddf893a1 100644 (file)
@@ -31,6 +31,7 @@ static unsigned int free_huge_pages_node[MAX_NUMNODES];
 static unsigned int surplus_huge_pages_node[MAX_NUMNODES];
 static gfp_t htlb_alloc_mask = GFP_HIGHUSER;
 unsigned long hugepages_treat_as_movable;
+int hugetlb_dynamic_pool;
 
 /*
  * Protects updates to hugepage_freelists, nr_huge_pages, and free_huge_pages
@@ -201,6 +202,10 @@ static struct page *alloc_buddy_huge_page(struct vm_area_struct *vma,
 {
        struct page *page;
 
+       /* Check if the dynamic pool is enabled */
+       if (!hugetlb_dynamic_pool)
+               return NULL;
+
        page = alloc_pages(htlb_alloc_mask|__GFP_COMP|__GFP_NOWARN,
                                        HUGETLB_PAGE_ORDER);
        if (page) {