printk: Create helper function to queue deferred console handling
authorPetr Mladek <pmladek@suse.com>
Wed, 27 Jun 2018 14:08:16 +0000 (16:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Sep 2018 07:26:34 +0000 (09:26 +0200)
commit a338f84dc196f44b63ba0863d2f34fd9b1613572 upstream.

It is just a preparation step. The patch does not change
the existing behavior.

Link: http://lkml.kernel.org/r/20180627140817.27764-3-pmladek@suse.com
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Acked-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/printk/printk.c

index f90af2b6c9567a2ca5fa71c94e951c95143ec13e..f0223a7d9ed1bca96b24b4da3053d3b0e160272c 100644 (file)
@@ -2723,16 +2723,20 @@ void wake_up_klogd(void)
        preempt_enable();
 }
 
-int vprintk_deferred(const char *fmt, va_list args)
+void defer_console_output(void)
 {
-       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();
+}
+
+int vprintk_deferred(const char *fmt, va_list args)
+{
+       int r;
+
+       r = vprintk_emit(0, LOGLEVEL_SCHED, NULL, 0, fmt, args);
+       defer_console_output();
 
        return r;
 }