lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1325610347.2320.109.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>
Date:	Tue, 03 Jan 2012 18:05:47 +0100
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	David Laight <David.Laight@...LAB.COM>
Cc:	pablo@...filter.org, netfilter-devel@...r.kernel.org,
	davem@...emloft.net, netdev@...r.kernel.org
Subject: RE: [PATCH 06/19] netfilter: nf_conntrack: use atomic64 for
 accounting counters

Le mardi 03 janvier 2012 à 14:37 +0100, Eric Dumazet a écrit :
> Le mardi 03 janvier 2012 à 14:31 +0100, Eric Dumazet a écrit :
> > 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.
> > 
> > 
> 
> Oops sorry, I misread your mail, I thought you were speaking of UP
> kernel.
> 

I got confused because your argument applies to 64bit platform as well
(two atomic ops instead of one in spin_lock_bh())

As a matter of fact, atomic64_[inc|add]() use two locked operations on
32bit.

Plus this code (atomic64_xxx_cx8()) seems very buggy since 2.6.35
kernels ... Oh well...


--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ