4

Quite interested in the size of the kernel ring buffer, how much information it can hold, and what data types?

  • On some embedded boxes it might differ. In my system, it's kept under /VERSION.gz and can be queried as zgrep LOG_BUF_SHIFT /VERION.gz – tsenapathy Jan 25 '18 at 18:35
6

Regarding the size, it's recorded in your kernel's config file. For example, on Amazon EC2 here, it's 256 KiB.

# grep CONFIG_LOG_BUF_SHIFT /boot/config-`uname -r`
CONFIG_LOG_BUF_SHIFT=18
# perl -e 'printf "%d KiB\n",(1<<18)/1024'
256 KiB
#

Referenced in /kernel/printk/printk.c

#define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)

More information in /kernel/trace/ring_buffer.c

Note that if you've passed a kernel boot param "log_buf_len=N" (check using cat /proc/cmdline) then that overrides the value in the config file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.