[3.13.y-ckt stable] Patch "mm: fix potential infinite loop in dissolve_free_huge_pages()" has been added to staging queue

Kamal Mostafa kamal at canonical.com
Thu Jul 23 01:59:16 UTC 2015


This is a note to let you know that I have just added a patch titled

    mm: fix potential infinite loop in dissolve_free_huge_pages()

to the linux-3.13.y-queue branch of the 3.13.y-ckt extended stable tree 
which can be found at:

    http://kernel.ubuntu.com/git/ubuntu/linux.git/log/?h=linux-3.13.y-queue

This patch is scheduled to be released in version 3.13.11-ckt24.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.13.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Kamal

------

>From 78c2699fac6de0f4dc56d7d23a910fdada2d6b47 Mon Sep 17 00:00:00 2001
From: Li Zhong <zhong at linux.vnet.ibm.com>
Date: Wed, 6 Aug 2014 16:07:56 -0700
Subject: mm: fix potential infinite loop in dissolve_free_huge_pages()

commit d0177639310d23c7739500df3c6ce6fdfe34acec upstream.

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().

[rientjes at google.com: no legitimate reason to call dissolve_free_huge_pages() when !hugepages_supported()]
Signed-off-by: Li Zhong <zhong at linux.vnet.ibm.com>
Acked-by: Naoya Horiguchi <n-horiguchi at ah.jp.nec.com>
Acked-by: David Rientjes <rientjes at google.com>
Signed-off-by: David Rientjes <rientjes at google.com>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
[ kamal: 3.13-stable prereq for
  641844f mm/hugetlb: introduce minimum hugepage order ]
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
---
 mm/hugetlb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 072b673..3b9d346 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -920,6 +920,9 @@ void dissolve_free_huge_pages(unsigned long start_pfn, unsigned long end_pfn)
 	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))
--
1.9.1





More information about the kernel-team mailing list