[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190131093342-mutt-send-email-mst@kernel.org>
Date: Thu, 31 Jan 2019 09:39:34 -0500
From: "Michael S. Tsirkin" <mst@...hat.com>
To: fei phung <feiphung27@...il.com>
Cc: feiphung@...mail.com, netdev@...r.kernel.org
Subject: Re: Question on ptr_ring linux header
On Thu, Jan 31, 2019 at 01:16:31PM +0800, fei phung wrote:
> Hi,
>
> /*
> * Filename: circ_ring.c
> * Version: 1.0
> * Description: A circular buffer using API from
> * https://github.com/torvalds/linux/blob/master/include/linux/ptr_ring.h
> */
>
> ptr_ring's void** queue is just giving data race problem, running
> consume() together with [assignment of pointers+produce()] will
> definitely give rise to data race
>
> mutex or lock cannot help in this case. Please correct me if wrong
>
> Regards,
> Phung
I am not sure what does assignment of pointers mean in this context.
ptr_ring is designed for a single producer and a single consumer. For
why it works see explanation about data dependencies in
Documentation/memory-barriers.txt. You will have to be more specific
about the data race that you see if you expect more specific answers.
Thanks,
--
MST
Powered by blists - more mailing lists