diff options
author | John Ogness <john.ogness@linutronix.de> | 2020-12-09 01:50:53 +0106 |
---|---|---|
committer | Petr Mladek <pmladek@suse.com> | 2020-12-09 11:31:02 +0100 |
commit | b031a684bfd01d633c79d281bd0cf11c2f834ada (patch) | |
tree | ca2ab9169fe3eba5a846f4cc02cef15395d55317 /lib/ratelimit.c | |
parent | 6b916706f8f09348cfa4fdd3642ebf87d6a2a26b (diff) |
printk: remove logbuf_lock writer-protection of ringbuffer
Since the ringbuffer is lockless, there is no need for it to be
protected by @logbuf_lock. Remove @logbuf_lock writer-protection of
the ringbuffer. The reader-protection is not removed because some
variables, used by readers, are using @logbuf_lock for synchronization:
@syslog_seq, @syslog_time, @syslog_partial, @console_seq,
struct kmsg_dumper.
For PRINTK_NMI_DIRECT_CONTEXT_MASK, @logbuf_lock usage is not removed
because it may be used for dumper synchronization.
Without @logbuf_lock synchronization of vprintk_store() it is no
longer possible to use the single static buffer for temporarily
sprint'ing the message. Instead, use vsnprintf() to determine the
length and perform the real vscnprintf() using the area reserved from
the ringbuffer. This leads to suboptimal packing of the message data,
but will result in less wasted storage than multiple per-cpu buffers
to support lockless temporary sprint'ing.
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20201209004453.17720-3-john.ogness@linutronix.de
Diffstat (limited to 'lib/ratelimit.c')
0 files changed, 0 insertions, 0 deletions