[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <531E1446.1030705@gmail.com>
Date: Mon, 10 Mar 2014 12:36:38 -0700
From: John Fastabend <john.fastabend@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>
CC: xiyou.wangcong@...il.com, jhs@...atatu.com, netdev@...r.kernel.org,
davem@...emloft.net
Subject: Re: [RCU PATCH 13/14] net: sched: make bstats per cpu and estimator
RCU safe
On 03/10/2014 11:06 AM, Eric Dumazet wrote:
> On Mon, 2014-03-10 at 10:08 -0700, John Fastabend wrote:
>
>> +void
>> +__gnet_stats_copy_basic_cpu(struct gnet_stats_basic_packed *bstats,
>> + struct gnet_stats_basic_cpu *b)
>> +{
>> + int i;
>> +
>> + for_each_possible_cpu(i) {
>> + struct gnet_stats_basic_cpu *bcpu = per_cpu_ptr(b, i);
>> + unsigned int start;
>> +
>> + do {
>> + start = u64_stats_fetch_begin_bh(&bcpu->syncp);
>> + bstats->bytes += bcpu->bstats.bytes;
>> + bstats->packets += bcpu->bstats.packets;
>> + } while (u64_stats_fetch_retry_bh(&bcpu->syncp, start));
>> + }
>> +}
>
> This is buggy. You need to use temporary variables, otherwise if the
> retry is done, you add bcpu->bstats.bytes/packets multiple times.
>
>
Yep I'll fix this and your other comments when I respin this set. Thanks
for taking a look over the patches.
--
John Fastabend Intel Corporation
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists