[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090411080554.67a17410@nehalam>
Date: Sat, 11 Apr 2009 08:05:54 -0700
From: Stephen Hemminger <shemminger@...tta.com>
To: Ingo Molnar <mingo@...e.hu>
Cc: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
David Miller <davem@...emloft.net>,
Lai Jiangshan <laijs@...fujitsu.com>,
jeff.chua.linux@...il.com, dada1@...mosbay.com, jengelh@...ozas.de,
kaber@...sh.net, r000n@...0n.net,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
netfilter-devel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: iptables very slow after commit
784544739a25c30637397ace5489eeb6e15d7d49
On Sat, 11 Apr 2009 09:08:54 +0200
Ingo Molnar <mingo@...e.hu> wrote:
>
> * Paul E. McKenney <paulmck@...ux.vnet.ibm.com> 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
The iptables counters are write mostly, read rarely so they don't
fit the seq counter or atomic use case. Also, it is important
to get a consistent snapshot of the whole set not just each
individual counter.
--
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