Skip to contentSkip to conversation

Patch "mm/hugetlb: avoid soft lockup in set_max_huge_pages()" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Aug 18, 2016

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

mm/hugetlb: avoid soft lockup in set_max_huge_pages()

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
mm-hugetlb-avoid-soft-lockup-in-set_max_huge_pages.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 649920c6ab93429b94bc7c1aa7c0e8395351be32 Mon Sep 17 00:00:00 2001

From: Jia He <[email protected]>
Date: Tue, 2 Aug 2016 14:02:31 -0700
Subject: mm/hugetlb: avoid soft lockup in set_max_huge_pages()

From: Jia He <[email protected]>

commit 649920c6ab93429b94bc7c1aa7c0e8395351be32 upstream.

In powerpc servers with large memory(32TB), we watched several soft lockups for hugepage under stress tests.

The call traces are as follows:
1.

get_page_from_freelist+0x2d8/0xd50
__alloc_pages_nodemask+0x180/0xc20
alloc_fresh_huge_page+0xb0/0x190
set_max_huge_pages+0x164/0x3b0

2.

prep_new_huge_page+0x5c/0x100
alloc_fresh_huge_page+0xc8/0x190
set_max_huge_pages+0x164/0x3b0

This patch fixes such soft lockups. It is safe to call cond_resched() there because it is out of spin_lock/unlock section.

---
 mm/hugetlb.c |    4 ++++
 1 file changed, 4 insertions(+)
mm/hugetlb.c +4 -0
@@ -2170,6 +2170,10 @@ static unsigned long set_max_huge_pages(
 		 * and reducing the surplus.
 		 */
 		spin_unlock(&hugetlb_lock);
+
+		/* yield cpu to avoid soft lockup */
+		cond_resched();
+
 		if (hstate_is_gigantic(h))
 			ret = alloc_fresh_gigantic_page(h, nodes_allowed);
 		else

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/mm-hugetlb-avoid-soft-lockup-in-set_max_huge_pages.patch