Skip to content

Commit

Permalink
tracing: Kill trace_cpu struct/members
Browse files Browse the repository at this point in the history
After the previous changes trace_array_cpu->trace_cpu and
trace_array->trace_cpu becomes write-only. Remove these members
and kill "struct trace_cpu" as well.

As a side effect this also removes memset(per_cpu_memory, 0).
It was not needed, alloc_percpu() returns zero-filled memory.

Link: http://lkml.kernel.org/r/20130723152613.GA23741@redhat.com

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Oleg Nesterov authored and Steven Rostedt committed Jul 24, 2013
1 parent 6484c71 commit 9c01fe4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 29 deletions.
21 changes: 0 additions & 21 deletions kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -5865,17 +5865,6 @@ struct dentry *trace_instance_dir;
static void
init_tracer_debugfs(struct trace_array *tr, struct dentry *d_tracer);

static void init_trace_buffers(struct trace_array *tr, struct trace_buffer *buf)
{
int cpu;

for_each_tracing_cpu(cpu) {
memset(per_cpu_ptr(buf->data, cpu), 0, sizeof(struct trace_array_cpu));
per_cpu_ptr(buf->data, cpu)->trace_cpu.cpu = cpu;
per_cpu_ptr(buf->data, cpu)->trace_cpu.tr = tr;
}
}

static int
allocate_trace_buffer(struct trace_array *tr, struct trace_buffer *buf, int size)
{
Expand All @@ -5893,8 +5882,6 @@ allocate_trace_buffer(struct trace_array *tr, struct trace_buffer *buf, int size
return -ENOMEM;
}

init_trace_buffers(tr, buf);

/* Allocate the first page for all buffers */
set_buffer_entries(&tr->trace_buffer,
ring_buffer_size(tr->trace_buffer.buffer, 0));
Expand Down Expand Up @@ -5961,10 +5948,6 @@ static int new_instance_create(const char *name)
if (allocate_trace_buffers(tr, trace_buf_size) < 0)
goto out_free_tr;

/* Holder for file callbacks */
tr->trace_cpu.cpu = RING_BUFFER_ALL_CPUS;
tr->trace_cpu.tr = tr;

tr->dir = debugfs_create_dir(name, trace_instance_dir);
if (!tr->dir)
goto out_free_tr;
Expand Down Expand Up @@ -6438,10 +6421,6 @@ __init static int tracer_alloc_buffers(void)

global_trace.flags = TRACE_ARRAY_FL_GLOBAL;

/* Holder for file callbacks */
global_trace.trace_cpu.cpu = RING_BUFFER_ALL_CPUS;
global_trace.trace_cpu.tr = &global_trace;

INIT_LIST_HEAD(&global_trace.systems);
INIT_LIST_HEAD(&global_trace.events);
list_add(&global_trace.list, &ftrace_trace_arrays);
Expand Down
8 changes: 0 additions & 8 deletions kernel/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,12 @@ enum trace_flag_type {

struct trace_array;

struct trace_cpu {
struct trace_array *tr;
struct dentry *dir;
int cpu;
};

/*
* The CPU trace array - it consists of thousands of trace entries
* plus some other descriptor data: (for example which task started
* the trace, etc.)
*/
struct trace_array_cpu {
struct trace_cpu trace_cpu;
atomic_t disabled;
void *buffer_page; /* ring buffer spare */

Expand Down Expand Up @@ -196,7 +189,6 @@ struct trace_array {
bool allocated_snapshot;
#endif
int buffer_disabled;
struct trace_cpu trace_cpu; /* place holder */
#ifdef CONFIG_FTRACE_SYSCALLS
int sys_refcount_enter;
int sys_refcount_exit;
Expand Down

0 comments on commit 9c01fe4

Please sign in to comment.