• Sergey Senozhatsky's avatar
    printk: wake up klogd in vprintk_emit · 43a17111
    Sergey Senozhatsky authored
    We wake up klogd very late - only when current console_sem owner
    is done pushing pending kernel messages to the serial/net consoles.
    In some cases this results in lost syslog messages, because kernel
    log buffer is a circular buffer and if we don't wakeup syslog long
    enough there are chances that logbuf simply will wrap around.
    
    The patch moves the klogd wake up call to vprintk_emit(), which is
    the only legit way for a kernel message to appear in the logbuf,
    right after the attempt to handle consoles. As a result, klogd
    will get waken either after flushing the new message to consoles
    or immediately when consoles are still busy with older messages.
    
    Link: http://lkml.kernel.org/r/20180419014250.5692-1-sergey.senozhatsky@gmail.com
    To: Steven Rostedt <rostedt@goodmis.org>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Tejun Heo <tj@kernel.org>
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
    Signed-off-by: default avatarPetr Mladek <pmladek@suse.com>
    43a17111
printk.c 81.8 KB