lkml.org 
[lkml]   [2009]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: iptables very slow after commit 784544739a25c30637397ace5489eeb6e15d7d49

* Paul E. McKenney <paulmck@linux.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


\
 
 \ /
  Last update: 2009-04-11 09:11    [W:0.352 / U:0.568 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site