Re: [PATCH] perf/ring_buffer: Fix exposing a temporarily decreased data_head.
From: Alexander Shishkin
Date: Wed May 15 2019 - 02:52:56 EST
Yabin Cui <yabinc@xxxxxxxxxx> writes:
> diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
> index 674b35383491..0b9aefe13b04 100644
> --- a/kernel/events/ring_buffer.c
> +++ b/kernel/events/ring_buffer.c
> @@ -54,8 +54,10 @@ static void perf_output_put_handle(struct perf_output_handle *handle)
> * IRQ/NMI can happen here, which means we can miss a head update.
> */
>
> - if (!local_dec_and_test(&rb->nest))
> + if (local_read(&rb->nest) > 1) {
> + local_dec(&rb->nest);
What stops rb->nest changing between local_read() and local_dec()?
Regards,
--
Alex