Skip to contentSkip to conversation

hugetlb: Abort a hugepage pool resize if a signal is pending

PATCH In review Mel Gorman 2 participants 2 messages Dec 2, 2009

Subsystems (2)
lore
Share & tools
lore

Mel Gorman

author
#0 lore raw

PATCH 1/1 hugetlb: Abort a hugepage pool resize if a signal is pending

If a user asks for a hugepage pool resize but specified a large number, the machine can begin trashing. In response, they might hit ctrl-c but signals are ignored and the pool resize continues until it fails an allocation. This can take a considerable amount of time so this patch aborts a pool resize if a signal is pending.

---
 mm/hugetlb.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
mm/hugetlb.c +3 -0
index af02ee8..a952cb8 100644
@@ -1238,6 +1238,9 @@ static unsigned long set_max_huge_pages(struct hstate *h, unsigned long count)
 		if (!ret)
 			goto out;
 
+		/* Bail for signals. Probably ctrl-c from user */
+		if (signal_pending(current))
+			goto out;
 	}
 
 	/*

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw
Quoted 17 lines · Mel Gorman

If a user asks for a hugepage pool resize but specified a large number, the machine can begin trashing. In response, they might hit ctrl-c but signals are ignored and the pool resize continues until it fails an allocation. This can take a considerable amount of time so this patch aborts a pool resize if a signal is pending.

---
 mm/hugetlb.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
mm/hugetlb.c +0 -0
index af02ee8..a952cb8 100644

mm/hugetlb.c static unsigned long set_max_huge_pages(struct hstate *h, unsigned long count) · line 1243

Quoted 6 lines
mm/hugetlb.c +3 -0
@@ -1238,6 +1238,9 @@ static unsigned long set_max_huge_pages(struct hstate *h, unsigned long count)
 		if (!ret)
 			goto out;
 
+		/* Bail for signals. Probably ctrl-c from user */
+		if (signal_pending(current))
+			goto out;

Thanks, Mel!

This will help m unwedge my system the next time I fat-finger an extra zero or two into my hugepage pool size.

-- Dave