From: Paul Mundt <lethal@linux-sh.org>
Date: Fri, 14 Aug 2009 14:58:37 +0000 (+0900)
Subject: sh: unwinder: Convert frame allocations to GFP_ATOMIC.
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0fc11e3618bb1f9e0640127ec84f5d2690fa3894;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git

sh: unwinder: Convert frame allocations to GFP_ATOMIC.

save_stack_trace_tsk() and friends can be called from atomic context (as
triggered by latencytop), and subsequently hit two problematic allocation
points that were using GFP_KERNEL (these were dwarf_unwind_stack() and
dwarf_frame_alloc_regs()). Convert these over to GFP_ATOMIC and get
latencytop working with the DWARF unwinder.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
---

diff --git a/arch/sh/kernel/dwarf.c b/arch/sh/kernel/dwarf.c
index 83f3cc92549f..db021361b161 100644
--- a/arch/sh/kernel/dwarf.c
+++ b/arch/sh/kernel/dwarf.c
@@ -57,7 +57,7 @@ static void dwarf_frame_alloc_regs(struct dwarf_frame *frame,
 	if (frame->num_regs >= num_regs)
 		return;
 
-	regs = kzalloc(new_size, GFP_KERNEL);
+	regs = kzalloc(new_size, GFP_ATOMIC);
 	if (!regs) {
 		printk(KERN_WARNING "Unable to allocate DWARF registers\n");
 		/*
@@ -531,7 +531,7 @@ struct dwarf_frame *dwarf_unwind_stack(unsigned long pc,
 		define_ra = true;
 	}
 
-	frame = kzalloc(sizeof(*frame), GFP_KERNEL);
+	frame = kzalloc(sizeof(*frame), GFP_ATOMIC);
 	if (!frame)
 		return NULL;