Skip to contentSkip to conversation

use no-panic variant of alloc_bootmem() in alloc_large_system_hash()

PATCH New Jan Beulich 3 participants 7 messages Aug 4, 2008 – Aug 13, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 use no-panic variant of alloc_bootmem() in alloc_large_system_hash()

.. since a failed allocation is being (initially) handled gracefully, and panic()-ed upon failure explicitly in the function if retries with smaller sizes failed.

---
 include/linux/bootmem.h |    4 ++++
 mm/page_alloc.c         |    2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
include/linux/bootmem.h +4 -0
@@ -97,10 +97,14 @@ extern void *__alloc_bootmem_low_node(pg
 #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
 #define alloc_bootmem(x) \
 	__alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
+#define alloc_bootmem_nopanic(x) \
+	__alloc_bootmem_nopanic(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
 #define alloc_bootmem_low(x) \
 	__alloc_bootmem_low(x, SMP_CACHE_BYTES, 0)
 #define alloc_bootmem_pages(x) \
 	__alloc_bootmem(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
+#define alloc_bootmem_pages_nopanic(x) \
+	__alloc_bootmem_nopanic(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
 #define alloc_bootmem_low_pages(x) \
 	__alloc_bootmem_low(x, PAGE_SIZE, 0)
 #define alloc_bootmem_node(pgdat, x) \
mm/page_alloc.c +1 -1
@@ -4454,7 +4454,7 @@ void *__init alloc_large_system_hash(con
 	do {
 		size = bucketsize << log2qty;
 		if (flags & HASH_EARLY)
-			table = alloc_bootmem(size);
+			table = alloc_bootmem_nopanic(size);
 		else if (hashdist)
 			table = __vmalloc(size, GFP_ATOMIC, PAGE_KERNEL);
 		else {
#1 lore raw

PATCH 1/1 Propagate new nonpanic bootmem macros to CONFIG_HAVE_ARCH_BOOTMEM_NODE

Commit 74768ed833344b "page allocator: use no-panic variant of alloc_bootmem() in alloc_large_system_hash()" introduced two new _nopanic macros which are undefined for CONFIG_HAVE_ARCH_BOOTMEM_NODE.

---

These macros are a mess... :(

include/asm-x86/mmzone_32.h +6 -0
index b2298a2..5862e64 100644
@@ -97,10 +97,16 @@ static inline int pfn_valid(int pfn)
 	reserve_bootmem_node(NODE_DATA(0), (addr), (size), (flags))
 #define alloc_bootmem(x) \
 	__alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
+#define alloc_bootmem_nopanic(x) \
+	__alloc_bootmem_node_nopanic(NODE_DATA(0), (x), SMP_CACHE_BYTES, \
+				__pa(MAX_DMA_ADDRESS))
 #define alloc_bootmem_low(x) \
 	__alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, 0)
 #define alloc_bootmem_pages(x) \
 	__alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
+#define alloc_bootmem_pages_nopanic(x) \
+	__alloc_bootmem_node_nopanic(NODE_DATA(0), (x), PAGE_SIZE, \
+				__pa(MAX_DMA_ADDRESS))
 #define alloc_bootmem_low_pages(x) \
 	__alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0)
 #define alloc_bootmem_node(pgdat, x)					\
author Acked-by on v1 1/1
#2 lore raw

Re: [PATCH] Propagate new nonpanic bootmem macros to CONFIG_HAVE_ARCH_BOOTMEM_NODE

Sorry for not noticing this:

Quoted 1 line
Quoted 1 line
Quoted 1 line

Johannes Weiner <[email protected]> 13.08.08 10:17 >>>

Commit 74768ed833344b "page allocator: use no-panic variant of alloc_bootmem() in alloc_large_system_hash()" introduced two new _nopanic macros which are undefined for CONFIG_HAVE_ARCH_BOOTMEM_NODE.

---

These macros are a mess... :(

include/asm-x86/mmzone_32.h +6 -0
index b2298a2..5862e64 100644
@@ -97,10 +97,16 @@ static inline int pfn_valid(int pfn)
 	reserve_bootmem_node(NODE_DATA(0), (addr), (size), (flags))
 #define alloc_bootmem(x) \
 	__alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
+#define alloc_bootmem_nopanic(x) \
+	__alloc_bootmem_node_nopanic(NODE_DATA(0), (x), SMP_CACHE_BYTES, \
+				__pa(MAX_DMA_ADDRESS))
 #define alloc_bootmem_low(x) \
 	__alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, 0)
 #define alloc_bootmem_pages(x) \
 	__alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
+#define alloc_bootmem_pages_nopanic(x) \
+	__alloc_bootmem_node_nopanic(NODE_DATA(0), (x), PAGE_SIZE, \
+				__pa(MAX_DMA_ADDRESS))
 #define alloc_bootmem_low_pages(x) \
 	__alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0)
 #define alloc_bootmem_node(pgdat, x)					\
#3 lore raw

Re: [PATCH] Propagate new nonpanic bootmem macros to CONFIG_HAVE_ARCH_BOOTMEM_NODE

Quoted 9 lines · Jan Beulich

Sorry for not noticing this:

Quoted 1 line
Quoted 1 line
Quoted 1 line

Johannes Weiner <[email protected]> 13.08.08 10:17 >>>

Commit 74768ed833344b "page allocator: use no-panic variant of alloc_bootmem() in alloc_large_system_hash()" introduced two new _nopanic macros which are undefined for CONFIG_HAVE_ARCH_BOOTMEM_NODE.

btw., i dont think the fix is complete, a quick grep shows:

arch/avr32/Kconfig:config HAVE_ARCH_BOOTMEM_NODE

Ingo

#4 lore raw

Re: [PATCH] Propagate new nonpanic bootmem macros to CONFIG_HAVE_ARCH_BOOTMEM_NODE

Hi Ingo,

Quoted 10 lines · Ingo Molnar
Quoted 8 lines · Jan Beulich

Sorry for not noticing this:

Quoted 1 line
Quoted 1 line
Quoted 1 line

Johannes Weiner <[email protected]> 13.08.08 10:17 >>>

Commit 74768ed833344b "page allocator: use no-panic variant of alloc_bootmem() in alloc_large_system_hash()" introduced two new _nopanic macros which are undefined for CONFIG_HAVE_ARCH_BOOTMEM_NODE.

Quoted 5 lines
Quoted 1 line

btw., i dont think the fix is complete, a quick grep shows:

arch/avr32/Kconfig:config HAVE_ARCH_BOOTMEM_NODE

Uhm, I think a fix for that would be removing the knob from the avr32 Kconfig. It defaults to n and I couldn't find a place where this gets enabled.

Furthermore, there doesn't seem to be any arch-specific code associated with it (grep -R ARCH_BOOTMEM_NODE arch/avr32).

Hannes

#5 lore raw

Re: [PATCH] Propagate new nonpanic bootmem macros to CONFIG_HAVE_ARCH_BOOTMEM_NODE

Quoted 18 lines · Johannes Weiner

Hi Ingo,

Quoted 14 lines · Ingo Molnar
Quoted 9 lines · Jan Beulich

Sorry for not noticing this:

Quoted 1 line
Quoted 1 line
Quoted 1 line

Johannes Weiner <[email protected]> 13.08.08 10:17 >>>

Commit 74768ed833344b "page allocator: use no-panic variant of alloc_bootmem() in alloc_large_system_hash()" introduced two new _nopanic macros which are undefined for CONFIG_HAVE_ARCH_BOOTMEM_NODE.

btw., i dont think the fix is complete, a quick grep shows:

Quoted 8 lines
Quoted 1 line

arch/avr32/Kconfig:config HAVE_ARCH_BOOTMEM_NODE

Uhm, I think a fix for that would be removing the knob from the avr32 Kconfig. It defaults to n and I couldn't find a place where this gets enabled.

Furthermore, there doesn't seem to be any arch-specific code associated with it (grep -R ARCH_BOOTMEM_NODE arch/avr32).

ok, indeed. I dont think it should be removed: it makes sense for an architecture to list all Kconfig knobs that _might_ matter - even if they are disabled for an architecture.

That makes it easier to know whether a Kconfig knob that is disables is disabled because the arch wants it disabled, because the arch wants it enabled, or because it's a knew knob the arch does not know about yet. So it's 3 states really.

Ingo

Applied
#6 lore raw

Re: [PATCH] Propagate new nonpanic bootmem macros to CONFIG_HAVE_ARCH_BOOTMEM_NODE

In reply to Johannes Weiner
Quoted 3 lines · Johannes Weiner

Commit 74768ed833344b "page allocator: use no-panic variant of alloc_bootmem() in alloc_large_system_hash()" introduced two new _nopanic macros which are undefined for CONFIG_HAVE_ARCH_BOOTMEM_NODE.

the above bootmem commit from yesterday broke the -rc3 32-bit NUMA build:

mm/page_alloc.c: In function ‘alloc_large_system_hash':
mm/page_alloc.c:4440: error: implicit declaration of function ‘alloc_bootmem_nopanic' mm/page_alloc.c:4440: warning: assignment makes pointer from integer without a cast

i have queued your fix up in tip/x86/urgent, thanks Johannes.

Ingo