[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20101119.082125.193710226.davem@davemloft.net>
Date: Fri, 19 Nov 2010 08:21:25 -0800 (PST)
From: David Miller <davem@...emloft.net>
To: eric.dumazet@...il.com
Cc: hagen@...u.net, netdev@...r.kernel.org, xiaosuo@...il.com
Subject: Re: [PATCH net-next-2.6] filter: optimize sk_run_filter
From: Eric Dumazet <eric.dumazet@...il.com>
Date: Fri, 19 Nov 2010 12:17:52 +0100
> Le vendredi 19 novembre 2010 à 10:54 +0100, Eric Dumazet a écrit :
>
>> I believe we should revert the u32 f_k = fentry->k; part
>>
>> fentry->k as is fast as f_k if stored on stack, and avoids one
>> instruction if fentry->k is not needed.
>>
>>
>
> A revert is not good on arches with decent number of registers (x86_64
> for example).
-EFIX_THE_DAMN_COMPILER
We never make calls out of this function or touch volatile memory or
create a full memory barrier between the assignment of f_k and it's
uses.
Therefore if common sub-expression elimination is working the compiler
will be able to decide properly whether to access things via memory or
use a register for the value.
Remember this is why we have that ACCESS_ONCE() thing.
We can't have it both ways, either ACCESS_ONCE() should be removed or
we should never make changes like your's and instead should submit
compiler bug reports :-)
--
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