On 5/31/19 7:45 AM, Herbert Xu wrote: > On Fri, May 31, 2019 at 10:24:08AM +0200, Dmitry Vyukov wrote: >> >> OK, let's call it barrier. But we need more than a barrier here then. > > READ_ONCE/WRITE_ONCE is not some magical dust that you sprinkle > around in your code to make it work without locks. You need to > understand exactly why you need them and why the code would be > buggy if you don't use them. > > In this case the code doesn't need them because an implicit > barrier() (which is *stronger* than READ_ONCE/WRITE_ONCE) already > exists in both places. > More over, adding READ_ONCE() while not really needed prevents some compiler optimizations. ( Not in this particular case, since fqdir->dead is read exactly once, but we could have had a loop ) I have already explained that the READ_ONCE() was a leftover of the first version of the patch, that I refined later, adding correct (and slightly more complex) RCU barriers and rules. Dmitry, the self-documentation argument is perfectly good, but Herbert put much nicer ad hoc comments.
- [PATCH net-next 06/11] netfilter: ipv6: nf_defrag: no lon... Eric Dumazet
- [PATCH net-next 10/11] net: dynamically allocate fqdir st... Eric Dumazet
- [PATCH net-next 11/11] inet: frags: rework rhashtable dis... Eric Dumazet
- Re: [PATCH net-next 11/11] inet: frags: rework rhash... Herbert Xu
- Re: [PATCH net-next 11/11] inet: frags: rework r... Eric Dumazet
- [PATCH] inet: frags: Remove unnecessary smp_... Herbert Xu
- Re: [PATCH] inet: frags: Remove unnecess... Dmitry Vyukov
- Re: [PATCH] inet: frags: Remove unn... Herbert Xu
- Re: [PATCH] inet: frags: Remove... Dmitry Vyukov
- Re: [PATCH] inet: frags: Remove... Herbert Xu
- Re: [PATCH] inet: frags: Remove... Eric Dumazet
- Re: [PATCH] inet: frags: Remove... Andrea Parri
- Re: [PATCH] inet: frags: Remove... Eric Dumazet
- Re: [PATCH] inet: frags: Remove... Dmitry Vyukov
- Re: [PATCH] inet: frags: Remove... Paul E. McKenney
- Re: [PATCH] inet: frags: Remove... Eric Dumazet
- Re: [PATCH] inet: frags: Remove unnecess... Eric Dumazet
- Re: [PATCH] inet: frags: Remove unnecess... David Miller
- Re: [PATCH net-next 00/11] inet: frags: avoid possible ra... David Miller