Skip to content

Commit

Permalink
ring-buffer: use BUF_PAGE_HDR_SIZE in calculating index
Browse files Browse the repository at this point in the history
The index of the event is found by masking PAGE_MASK to it and
subtracting the header size. Currently the header size is calculate
by PAGE_SIZE - BUF_PAGE_SIZE, when we already have a macro
BUF_PAGE_HDR_SIZE to define it.

If we want to change BUF_PAGE_SIZE to something less than filling
the rest of the page (this is done for debugging), then we break
the algorithm to find the index.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed Jun 17, 2009
1 parent 44ad18e commit 22f470f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/trace/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ rb_event_index(struct ring_buffer_event *event)
{
unsigned long addr = (unsigned long)event;

return (addr & ~PAGE_MASK) - (PAGE_SIZE - BUF_PAGE_SIZE);
return (addr & ~PAGE_MASK) - BUF_PAGE_HDR_SIZE;
}

static inline int
Expand Down

0 comments on commit 22f470f

Please sign in to comment.