Skip to content

Commit

Permalink
printk: disable preemption for printk_sched
Browse files Browse the repository at this point in the history
An earlier change in -mm (printk: remove separate printk_sched
buffers...), removed the printk_sched irqsave/restore lines since it was
safe for current users.  Since we may be expanding usage of
printk_sched(), disable preepmtion for this function to make it more
generally safe to call.

Signed-off-by: John Stultz <[email protected]>
Reviewed-by: Jan Kara <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Jiri Bohac <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Steven Rostedt <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
johnstultz-work authored and torvalds committed Jun 4, 2014
1 parent 458df9f commit 8195460
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kernel/printk/printk.c
Original file line number Diff line number Diff line change
Expand Up @@ -2590,12 +2590,14 @@ int printk_sched(const char *fmt, ...)
va_list args;
int r;

preempt_disable();
va_start(args, fmt);
r = vprintk_emit(0, SCHED_MESSAGE_LOGLEVEL, NULL, 0, fmt, args);
va_end(args);

__this_cpu_or(printk_pending, PRINTK_PENDING_OUTPUT);
irq_work_queue(&__get_cpu_var(wake_up_klogd_work));
preempt_enable();

return r;
}
Expand Down

0 comments on commit 8195460

Please sign in to comment.