Skip to contentSkip to conversation

sparc: replace __GFP_NOFAIL with GFP_ATOMIC in mdesc_kmalloc()

PATCH In review Ethan Zhao 2 participants 2 messages Jan 7, 2014 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore

Ethan Zhao

author
#0 lore raw

PATCH 1/1 sparc: replace __GFP_NOFAIL with GFP_ATOMIC in mdesc_kmalloc()

Has kmalloc() failure checking there, so it is unnecessary to allocate with __GFP_NOFAIL flag that might block forever.

---
 arch/sparc/kernel/mdesc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sparc/kernel/mdesc.c +1 -1
index b90bf23..e8d678c 100644
@@ -136,7 +136,7 @@ static struct mdesc_handle *mdesc_kmalloc(unsigned int mdesc_size)
 		       sizeof(struct mdesc_hdr) +
 		       mdesc_size);
 
-	base = kmalloc(handle_size + 15, GFP_KERNEL | __GFP_NOFAIL);
+	base = kmalloc(handle_size + 15, GFP_KERNEL | GFP_ATOMIC);
 	if (base) {
 		struct mdesc_handle *hp;
 		unsigned long addr;
Signature · 1 line
1.8.3.4 (Apple Git-47)
maintainer
#1 lore raw

From: Ethan Zhao <[email protected]>
Date: Tue, 7 Jan 2014 17:31:17 +0800

Quoted 4 lines

Has kmalloc() failure checking there, so it is unnecessary to allocate with __GFP_NOFAIL flag that might block forever.

This allocation failing borders on catastrophic. The allocation failure handling is just for looks.

This function is triggered when the firmware tells us that new cpus or other devices are available. This memory being allocated will hold the machine description that we traverse to find those new devices.

If this allocation is allowed to fail, we will never have any way to get the notification again. It really is __GFP_NOFAIL and must succeed.

I'm not applying this, sorry.