ftrace: Add information on number of page groups allocated
Looking for ways to shrink the size of the dyn_ftrace structure, knowing the information about how many pages and the number of groups of those pages, is useful in working out the best ways to save on memory. This adds one info print on how many groups of pages were used to allocate the ftrace dyn_ftrace structures, and also shows the number of pages and groups in the dyn_ftrace_total_info (which is used for debugging). Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
@@ -7583,14 +7583,23 @@ static ssize_t
|
||||
tracing_read_dyn_info(struct file *filp, char __user *ubuf,
|
||||
size_t cnt, loff_t *ppos)
|
||||
{
|
||||
unsigned long *p = filp->private_data;
|
||||
char buf[64]; /* Not too big for a shallow stack */
|
||||
ssize_t ret;
|
||||
char *buf;
|
||||
int r;
|
||||
|
||||
r = scnprintf(buf, 63, "%ld", *p);
|
||||
buf[r++] = '\n';
|
||||
/* 256 should be plenty to hold the amount needed */
|
||||
buf = kmalloc(256, GFP_KERNEL);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
|
||||
return simple_read_from_buffer(ubuf, cnt, ppos, buf, r);
|
||||
r = scnprintf(buf, 256, "%ld pages:%ld groups: %ld\n",
|
||||
ftrace_update_tot_cnt,
|
||||
ftrace_number_of_pages,
|
||||
ftrace_number_of_groups);
|
||||
|
||||
ret = simple_read_from_buffer(ubuf, cnt, ppos, buf, r);
|
||||
kfree(buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct file_operations tracing_dyn_info_fops = {
|
||||
@@ -8782,7 +8791,7 @@ static __init int tracer_init_tracefs(void)
|
||||
|
||||
#ifdef CONFIG_DYNAMIC_FTRACE
|
||||
trace_create_file("dyn_ftrace_total_info", 0444, d_tracer,
|
||||
&ftrace_update_tot_cnt, &tracing_dyn_info_fops);
|
||||
NULL, &tracing_dyn_info_fops);
|
||||
#endif
|
||||
|
||||
create_trace_instances(d_tracer);
|
||||
|
Reference in New Issue
Block a user