RE: [PATCH 06/19] netfilter: nf_conntrack: use atomic64 for accounting counters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le mardi 03 janvier 2012 à 12:01 +0000, David Laight a écrit :
> >  		if (acct) {
> > -			spin_lock_bh(&ct->lock);
> > -			acct[CTINFO2DIR(ctinfo)].packets++;
> > -			acct[CTINFO2DIR(ctinfo)].bytes += skb->len;
> > -			spin_unlock_bh(&ct->lock);
> > +			atomic64_inc(&acct[CTINFO2DIR(ctinfo)].packets);
> > +			atomic64_add(skb->len,
> &acct[CTINFO2DIR(ctinfo)].bytes);
> >  		}
> 
> On a 32bit arch the two atomic64 operations require a locked
> bus cycle each. The spin_unlock_bh() may not need one - so
> the code may now be slower (modulo lock contention etc).
> 
> Probably worth caching &acct[CTINFO2DIR(ctinfo)] in a local,
> the compiler probably can't do it itself.

You're mistaken.

Compile a UP kernel and check yourself before doing such claims.



--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux