提交 153368ce 编写于 作者: S Steven Rostedt (VMware)

ring-buffer: Optimize rb_iter_head_event()

As it is fine to perform several "peeks" of event data in the ring buffer
via the iterator before moving it forward, do not re-read the event, just
return what was read before. Otherwise, it can cause inconsistent results,
especially when testing multiple CPU buffers to interleave them.

Link: http://lkml.kernel.org/r/20200317213416.592032170@goodmis.orgSigned-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
上级 ff84c50c
...@@ -1929,6 +1929,9 @@ rb_iter_head_event(struct ring_buffer_iter *iter) ...@@ -1929,6 +1929,9 @@ rb_iter_head_event(struct ring_buffer_iter *iter)
unsigned long commit; unsigned long commit;
unsigned length; unsigned length;
if (iter->head != iter->next_event)
return iter->event;
/* /*
* When the writer goes across pages, it issues a cmpxchg which * When the writer goes across pages, it issues a cmpxchg which
* is a mb(), which will synchronize with the rmb here. * is a mb(), which will synchronize with the rmb here.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册