diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index f90af2b6c956..f0223a7d9ed1 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2723,16 +2723,20 @@ void wake_up_klogd(void) preempt_enable(); } +void defer_console_output(void) +{ + preempt_disable(); + __this_cpu_or(printk_pending, PRINTK_PENDING_OUTPUT); + irq_work_queue(this_cpu_ptr(&wake_up_klogd_work)); + preempt_enable(); +} + int vprintk_deferred(const char *fmt, va_list args) { int r; r = vprintk_emit(0, LOGLEVEL_SCHED, NULL, 0, fmt, args); - - preempt_disable(); - __this_cpu_or(printk_pending, PRINTK_PENDING_OUTPUT); - irq_work_queue(this_cpu_ptr(&wake_up_klogd_work)); - preempt_enable(); + defer_console_output(); return r; }