Re: [PATCH] net: filter: Convert the BPF VM to threaded code

From
Hagen Paul Pfeifer <hidden>
Date
2011-08-09 08:29:03
Reply to
Eric Dumazet, 2011-08-09
On Tue, 09 Aug 2011 07:00:27 +0200, Eric Dumazet wrote:


I tried this idea since its already an enum and all enum values are
handled in the switch, but all gcc versions I used still generate the
useless compare and branch (always predicted by modern CPU, so harmless
anyway ?)


Don't think so, the list is rather long - the CPU may not have any

indication. But strange that your gcc generate a conditional sequence of

cmp and conditional jump instruction instead of a jump table! Look at

commit 01f2f3f6ef4d076c, this is what I got after I refactored to an

_dense_ enum list.

 
(But this would need to use a larger kernel_sock_filter with not an u16
code, but the target address).


Not sure if the benefit is worth to try it. Can we avoid any cacheline

misses? I don't think so.




+		switch ((enum bpf_inst)fentry->code) {


That should not differ! Eric, sure that this do the trick?





Hagen
Thread (13 messages) 13 messages, 5 authors, last reply 2011-08-09
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help