Re: [PATCH] perf/ring_buffer: Fix exposing a temporarily decreased data_head.

From: Yabin Cui
Date: Thu May 16 2019 - 14:40:04 EST


>Indeed, good catch! Have you observed this, or is this patch due to code
inspection?

I observed this. I was using perf_event_open instead of linux tools perf
to monitor a process continuously forking new processes, generating a lot
of mmap records. And a sample record happens while generating a mmap record.

For missing barriers, I thought local_xxx provided implied barriers. But
I found atomic_ops.txt said not. Thanks for reminding! I will add them in
path v2.

I also think it's a good idea to use READ_ONCE/WRITE_ONCE for rb->nest. Will
use it in patch v2.