Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146163
b: refs/heads/master
c: be957c4
h: refs/heads/master
i:
  146161: 9b3b41d
  146159: 481e1bf
v: v3
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed May 11, 2009
1 parent b4bf724 commit 190839e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1cd8d7358948909ab80b254eb14bcebc555ad417
refs/heads/master: be957c447f7233a67904a1b11eb3ab61e702bf4d
14 changes: 9 additions & 5 deletions trunk/kernel/trace/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,9 @@ static inline int test_time_stamp(u64 delta)

#define BUF_PAGE_SIZE (PAGE_SIZE - BUF_PAGE_HDR_SIZE)

/* Max payload is BUF_PAGE_SIZE - header (8bytes) */
#define BUF_MAX_DATA_SIZE (BUF_PAGE_SIZE - (sizeof(u32) * 2))

int ring_buffer_print_page_header(struct trace_seq *s)
{
struct buffer_data_page field;
Expand Down Expand Up @@ -1396,6 +1399,7 @@ rb_reserve_next_event(struct ring_buffer_per_cpu *cpu_buffer,
int commit = 0;
int nr_loops = 0;

length = rb_calculate_event_length(length);
again:
/*
* We allow for interrupts to reenter here and do a trace.
Expand Down Expand Up @@ -1552,8 +1556,7 @@ ring_buffer_lock_reserve(struct ring_buffer *buffer, unsigned long length)
if (atomic_read(&cpu_buffer->record_disabled))
goto out;

length = rb_calculate_event_length(length);
if (length > BUF_PAGE_SIZE)
if (length > BUF_MAX_DATA_SIZE)
goto out;

event = rb_reserve_next_event(cpu_buffer, length);
Expand Down Expand Up @@ -1758,7 +1761,6 @@ int ring_buffer_write(struct ring_buffer *buffer,
{
struct ring_buffer_per_cpu *cpu_buffer;
struct ring_buffer_event *event;
unsigned long event_length;
void *body;
int ret = -EBUSY;
int cpu, resched;
Expand All @@ -1781,8 +1783,10 @@ int ring_buffer_write(struct ring_buffer *buffer,
if (atomic_read(&cpu_buffer->record_disabled))
goto out;

event_length = rb_calculate_event_length(length);
event = rb_reserve_next_event(cpu_buffer, event_length);
if (length > BUF_MAX_DATA_SIZE)
goto out;

event = rb_reserve_next_event(cpu_buffer, length);
if (!event)
goto out;

Expand Down

0 comments on commit 190839e

Please sign in to comment.