Skip to contentSkip to conversation

bootmem: Make ___alloc_bootmem_node_nopanic() to be real nopanic

PATCH New Yinghai Lu 1 participant 2 messages Jul 12, 2012 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Yinghai Lu

author
#1 lore raw

PATCH 1/1 bootmem: Make ___alloc_bootmem_node_nopanic() to be real nopanic

after

| From 99ab7b19440a72ebdf225f99b20f8ef40decee86 Mon Sep 17 00:00:00 2001
| Date: Wed, 11 Jul 2012 14:02:53 -0700
| Subject: [PATCH] mm: sparse: fix usemap allocation above node descriptor

section

Johannes said:

| while backporting the below patch, I realised that your fix busted
| f5bf18fa22f8 again.  The problem was not a panicking version on
| allocation failure but when the usemap size was too large such that
| goal + size > limit triggers the BUG_ON in the bootmem allocator.  So
| we need a version that passes limit ONLY if the usemap is smaller than
| the section.

after checking the code, the name of ___alloc_bootmem_node_nopanic() does not reflect the fact.

Make bootmem really not panic.

Hope will kill bootmem sooner.

Cc Andrew Morton <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc <[email protected]> [3.3.x, 3.4.x]
---
 mm/bootmem.c |    4 ++++
 1 file changed, 4 insertions(+)
mm/bootmem.c +4 -0
Index: linux-2.6/mm/bootmem.c
===================================================================
@@ -710,6 +710,10 @@ again:
 	if (ptr)
 		return ptr;
 
+	/* do not panic in alloc_bootmem_bdata() */
+	if (limit && goal + size > limit)
+		limit = 0;
+
 	ptr = alloc_bootmem_bdata(pgdat->bdata, size, align, goal, limit);
 	if (ptr)
 		return ptr;

--
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>

author
#2 lore raw

PATCH 1/1 bootmem: Make ___alloc_bootmem_node_nopanic() to be real nopanic

In reply to a message not in the archive

after

| From 99ab7b19440a72ebdf225f99b20f8ef40decee86 Mon Sep 17 00:00:00 2001
| Date: Wed, 11 Jul 2012 14:02:53 -0700
| Subject: [PATCH] mm: sparse: fix usemap allocation above node descriptor

section

Johannes said:

| while backporting the below patch, I realised that your fix busted
| f5bf18fa22f8 again.  The problem was not a panicking version on
| allocation failure but when the usemap size was too large such that
| goal + size > limit triggers the BUG_ON in the bootmem allocator.  So
| we need a version that passes limit ONLY if the usemap is smaller than
| the section.

after checking the code, the name of ___alloc_bootmem_node_nopanic() does not reflect the fact.

Make bootmem really not panic.

Hope will kill bootmem sooner.

Cc Andrew Morton <[email protected]>
Cc Johannes Weiner <[email protected]>
---
 mm/bootmem.c |    4 ++++
 1 file changed, 4 insertions(+)
mm/bootmem.c +4 -0
Index: linux-2.6/mm/bootmem.c
===================================================================
@@ -710,6 +710,10 @@ again:
 	if (ptr)
 		return ptr;
 
+	/* do not panic in alloc_bootmem_bdata() */
+	if (limit && goal + size > limit)
+		limit = 0;
+
 	ptr = alloc_bootmem_bdata(pgdat->bdata, size, align, goal, limit);
 	if (ptr)
 		return ptr;