From: Li Zhong <[email protected]>
Subject: mm: fix potential infinite loop in dissolve_free_huge_pages()

It is possible for some platforms, such as powerpc to set HPAGE_SHIFT to 0
to indicate huge pages not supported.

When this is the case, hugetlbfs could be disabled during boot time:
hugetlbfs: disabling because there are no supported hugepage sizes

Then in dissolve_free_huge_pages(), order is kept maximum (64 for 64bits),
and the for loop below won't end: for (pfn = start_pfn; pfn < end_pfn; pfn
+= 1 << order)

As suggested by Naoya, below fix checks hugepages_supported() before
calling dissolve_free_huge_pages().

[[email protected]: no legitimate reason to call dissolve_free_huge_pages() 
when !hugepages_supported()]
Signed-off-by: Li Zhong <[email protected]>
Acked-by: Naoya Horiguchi <[email protected]>
Acked-by: David Rientjes <[email protected]>
Signed-off-by: David Rientjes <[email protected]>
Cc: <[email protected]>    [3.12+]
Signed-off-by: Andrew Morton <[email protected]>
---

 mm/hugetlb.c |    3 +++
 1 file changed, 3 insertions(+)

diff -puN 
mm/hugetlb.c~mm-fix-potential-infinite-loop-in-dissolve_free_huge_pages 
mm/hugetlb.c
--- a/mm/hugetlb.c~mm-fix-potential-infinite-loop-in-dissolve_free_huge_pages
+++ a/mm/hugetlb.c
@@ -1088,6 +1088,9 @@ void dissolve_free_huge_pages(unsigned l
        unsigned long pfn;
        struct hstate *h;
 
+       if (!hugepages_supported())
+               return;
+
        /* Set scan step to minimum hugepage size */
        for_each_hstate(h)
                if (order > huge_page_order(h))
_
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to