lkml.org 
[lkml]   [2015]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] More precise timestamps for nested writes
On Mon, Apr 13, 2015 at 09:38:01PM -0500, Suresh E. Warrier wrote:

> diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
> index c9b3005..0a2d862 100644
> --- a/kernel/trace/ring_buffer.c
> +++ b/kernel/trace/ring_buffer.c
> @@ -482,6 +482,7 @@ struct ring_buffer_per_cpu {
> unsigned long read_bytes;
> u64 write_stamp;
> u64 read_stamp;
> + u64 last_stamp;
> /* ring buffer pages to update, > 0 to add, < 0 to remove */
> int nr_pages_to_update;
> struct list_head new_pages; /* new pages to add */

So what is wrong with something like:

u64 rb_get_delta(struct ring_buffer_per_cpu *cpu_buffer)
{
u64 last, now;

for (;;) {
last = cpu_buffer->last_stamp;
now = cpu_buffer->buffer->clock();

if (cmpxchg_local(&cpu_buffer->last_stamp, last, now) == last)
break;

cpu_relax();
}

return now - last;
}

Of course, LL/SC on power stinks, but on most archs this is actually
fairly fast.


\
 
 \ /
  Last update: 2015-04-15 12:01    [W:0.084 / U:1.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site