Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755837AbZDKHJh (ORCPT ); Sat, 11 Apr 2009 03:09:37 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752311AbZDKHJX (ORCPT ); Sat, 11 Apr 2009 03:09:23 -0400 Received: from mx2.mail.elte.hu ([157.181.151.9]:57247 "EHLO mx2.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752244AbZDKHJW (ORCPT ); Sat, 11 Apr 2009 03:09:22 -0400 Date: Sat, 11 Apr 2009 09:08:54 +0200 From: Ingo Molnar To: "Paul E. McKenney" Cc: Linus Torvalds , David Miller , Lai Jiangshan , shemminger@vyatta.com, jeff.chua.linux@gmail.com, dada1@cosmosbay.com, jengelh@medozas.de, kaber@trash.net, r000n@r000n.net, Linux Kernel Mailing List , netfilter-devel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: iptables very slow after commit 784544739a25c30637397ace5489eeb6e15d7d49 Message-ID: <20090411070854.GC11799@elte.hu> References: <20090410095246.4fdccb56@s6510> <20090410.182507.140306636.davem@davemloft.net> <20090411041533.GB6822@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090411041533.GB6822@linux.vnet.ibm.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-ELTE-VirusStatus: clean X-ELTE-SpamScore: -1.5 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 2.0 X-ELTE-SpamCheck-Details: score=-1.5 required=5.9 tests=BAYES_00 autolearn=no SpamAssassin version=3.2.3 -1.5 BAYES_00 BODY: Bayesian spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1227 Lines: 33 * Paul E. McKenney wrote: > I will nevertheless suggest the following egregious hack to > get a consistent sample of one counter for some other CPU: > > a. Disable interrupts > b. Atomically exchange the bottom 32 bits of the > counter with the value zero. > c. Atomically exchange the top 32 bits of the counter > with the value zero. > d. Concatenate the values obtained in (b) and (c), which > is the snapshot value. Note, i have recently implemented full atomic64_t support on 32-bit x86, for the perfcounters code, based on the CMPXCHG8B instruction. Which, while not the lightest of instructions, is still much better than the sequence above. So i think a better approach would be to also add a dumb generic implementation for atomic64_t (using a global lock or so), and then generic code could just assume that atomic64_t always exists. It is far nicer - and faster as well - as the hack above, even on 32-bit x86. Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/