[RFC 2/2] ** do not apply this patch ** Just for illustration purposes

From: Frank A. Cancio Bello
Date: Wed Nov 13 2019 - 11:33:31 EST


Prints a message that will allow us to evaluate the number of pages
allocated by each CPU buffer as well the main values that participate
in its calculation.

$ echo 0 > /sys/kernel/debug/tracing/tracing_on
$ echo 4096 > /sys/kernel/debug/tracing/buffer_size_kb
.... e.g. of output:
PAGE_SIZE: 4096, BUF_PAGE_HDR_SIZE: 16, size: 4194304, nr_pages: 1029

Signed-off-by: Frank A. Cancio Bello <frank@xxxxxxxxxxxxxxxxxxxxxx>
---
kernel/trace/ring_buffer.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 66358d66c933..c10b6bcb29b9 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -1730,6 +1730,8 @@ int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size,
return size;

nr_pages = DIV_ROUND_UP(size, BUF_PAGE_SIZE);
+ printk(KERN_ALERT "PAGE_SIZE: %lu, BUF_PAGE_HDR_SIZE: %lu, size: %lu, nr_pages: %ld",
+ PAGE_SIZE, BUF_PAGE_HDR_SIZE, size, nr_pages);

/* we need a minimum of two pages */
if (nr_pages < 2)
--
2.17.1