}
 
 
-static void *is_hardirq_stack(unsigned long *stack, int cpu)
+static void *is_hardirq_stack(unsigned long *stack)
 {
-       void *irq = per_cpu(hardirq_stack, cpu);
+       void *irq = this_cpu_read(hardirq_stack);
 
        return is_irq_stack(stack, irq);
 }
 
-static void *is_softirq_stack(unsigned long *stack, int cpu)
+static void *is_softirq_stack(unsigned long *stack)
 {
-       void *irq = per_cpu(softirq_stack, cpu);
+       void *irq = this_cpu_read(softirq_stack);
 
        return is_irq_stack(stack, irq);
 }
                unsigned long *stack, unsigned long bp,
                const struct stacktrace_ops *ops, void *data)
 {
-       const unsigned cpu = get_cpu();
        int graph = 0;
        u32 *prev_esp;
 
        for (;;) {
                void *end_stack;
 
-               end_stack = is_hardirq_stack(stack, cpu);
+               end_stack = is_hardirq_stack(stack);
                if (!end_stack)
-                       end_stack = is_softirq_stack(stack, cpu);
+                       end_stack = is_softirq_stack(stack);
 
                bp = ops->walk_stack(task, stack, bp, ops, data,
                                     end_stack, &graph);
                        break;
                touch_nmi_watchdog();
        }
-       put_cpu();
 }
 EXPORT_SYMBOL(dump_trace);
 
 
 #endif
 };
 
-static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
-                                        unsigned *usedp, char **idp)
+static unsigned long *in_exception_stack(unsigned long stack, unsigned *usedp,
+                                        char **idp)
 {
        unsigned k;
 
         * 'stack' is in one of them:
         */
        for (k = 0; k < N_EXCEPTION_STACKS; k++) {
-               unsigned long end = per_cpu(orig_ist, cpu).ist[k];
+               unsigned long end = raw_cpu_ptr(&orig_ist)->ist[k];
                /*
                 * Is 'stack' above this exception frame's end?
                 * If yes then skip to the next frame.
 };
 
 static enum stack_type
-analyze_stack(int cpu, struct task_struct *task, unsigned long *stack,
+analyze_stack(struct task_struct *task, unsigned long *stack,
              unsigned long **stack_end, unsigned long *irq_stack,
              unsigned *used, char **id)
 {
        if ((unsigned long)task_stack_page(task) == addr)
                return STACK_IS_NORMAL;
 
-       *stack_end = in_exception_stack(cpu, (unsigned long)stack,
-                                       used, id);
+       *stack_end = in_exception_stack((unsigned long)stack, used, id);
        if (*stack_end)
                return STACK_IS_EXCEPTION;
 
                unsigned long *stack, unsigned long bp,
                const struct stacktrace_ops *ops, void *data)
 {
-       const unsigned cpu = get_cpu();
-       unsigned long *irq_stack = (unsigned long *)per_cpu(irq_stack_ptr, cpu);
+       unsigned long *irq_stack = (unsigned long *)this_cpu_read(irq_stack_ptr);
        unsigned used = 0;
        int graph = 0;
        int done = 0;
                enum stack_type stype;
                char *id;
 
-               stype = analyze_stack(cpu, task, stack, &stack_end,
-                                     irq_stack, &used, &id);
+               stype = analyze_stack(task, stack, &stack_end, irq_stack, &used,
+                                     &id);
 
                /* Default finish unless specified to continue */
                done = 1;
         * This handles the process stack:
         */
        bp = ops->walk_stack(task, stack, bp, ops, data, NULL, &graph);
-       put_cpu();
 }
 EXPORT_SYMBOL(dump_trace);
 
        unsigned long *irq_stack_end;
        unsigned long *irq_stack;
        unsigned long *stack;
-       int cpu;
        int i;
 
-       preempt_disable();
-       cpu = smp_processor_id();
-
-       irq_stack_end = (unsigned long *)(per_cpu(irq_stack_ptr, cpu));
+       irq_stack_end = (unsigned long *)this_cpu_read(irq_stack_ptr);
        irq_stack     = irq_stack_end - (IRQ_STACK_SIZE / sizeof(long));
 
        sp = sp ? : get_stack_pointer(task, regs);
                stack++;
                touch_nmi_watchdog();
        }
-       preempt_enable();
 
        pr_cont("\n");
        show_trace_log_lvl(task, regs, sp, bp, log_lvl);