Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 140921
b: refs/heads/master
c: 1852fcc
h: refs/heads/master
i:
  140919: d36a963
v: v3
  • Loading branch information
Steven Rostedt committed Mar 12, 2009
1 parent 60d5490 commit 054391c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 73c5162aa362a543793f4a957c6c536dcbaa89ce
refs/heads/master: 1852fcce181faa237c010a3dbedb473cf9d4555f
20 changes: 20 additions & 0 deletions trunk/kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -2357,6 +2357,26 @@ static int tracing_resize_ring_buffer(unsigned long size)
return ret;
}

/**
* tracing_update_buffers - used by tracing facility to expand ring buffers
*
* To save on memory when the tracing is never used on a system with it
* configured in. The ring buffers are set to a minimum size. But once
* a user starts to use the tracing facility, then they need to grow
* to their default size.
*
* This function is to be called when a tracer is about to be used.
*/
int tracing_update_buffers(void)
{
int ret = 0;

if (!ring_buffer_expanded)
ret = tracing_resize_ring_buffer(trace_buf_size);

return ret;
}

struct trace_option_dentry;

static struct trace_option_dentry *
Expand Down
3 changes: 3 additions & 0 deletions trunk/kernel/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,9 @@ static inline void trace_branch_disable(void)
}
#endif /* CONFIG_BRANCH_TRACER */

/* set ring buffers to default size if not already done so */
int tracing_update_buffers(void);

/* trace event type bit fields, not numeric */
enum {
TRACE_EVENT_TYPE_PRINTF = 1,
Expand Down
8 changes: 8 additions & 0 deletions trunk/kernel/trace/trace_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ ftrace_event_write(struct file *file, const char __user *ubuf,
if (!cnt || cnt < 0)
return 0;

ret = tracing_update_buffers();
if (ret < 0)
return ret;

ret = get_user(ch, ubuf++);
if (ret)
return ret;
Expand Down Expand Up @@ -331,6 +335,10 @@ event_enable_write(struct file *filp, const char __user *ubuf, size_t cnt,
if (ret < 0)
return ret;

ret = tracing_update_buffers();
if (ret < 0)
return ret;

switch (val) {
case 0:
case 1:
Expand Down

0 comments on commit 054391c

Please sign in to comment.