Re: [PATCH net-next-2.6] net: Introduce u64_stats_sync infrastructure

Eric Dumazet
2010-06-15T12:18:49Z

Le mardi 15 juin 2010 à 21:04 +1000, Nick Piggin a écrit :

> So if you have a regular seqlock, the sequence:
>
> write_seqcount_begin
> stat1++
> stat2--
> write_seqcount_end
>
> do read_seqcount_begin
> sum = stat1+stat2;
> while (read_seqcount_retry)
> BUG_ON(sum != 0);
>
> This code is OK. But if it is using your stat sync, then it is buggy.
> This is obvious to you of course, but someone who doesn't consider
> the implementation might get caught out.
>
> I guess all my other points are properties of seqcount code itself,
> but they are not documented really well with the seqlock API
> unfortunately.
>

Yep, not counting fact that stat_sync is a noop on 64 bits anyway, so
external synchronization is pretty much needed (and probably already
present on all path were I need this stuff. If not, it must be fixed)