[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1311931816.2843.3.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>
Date: Fri, 29 Jul 2011 11:30:16 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Rui Ueyama <rui314@...il.com>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH] net: filter: Convert the BPF VM to threaded code
Le vendredi 29 juillet 2011 à 01:10 -0700, Rui Ueyama a écrit :
> Convert the BPF VM to threaded code to improve performance.
>
> The BPF VM is basically a big for loop containing a switch statement. That is
> slow because for each instruction it checks the for loop condition and does the
> conditional branch of the switch statement.
>
> This patch eliminates the conditional branch, by replacing it with jump table
> using GCC's labels-as-values feature. The for loop condition check can also be
> removed, because the filter code always end with a RET instruction.
>
Well...
> +#define NEXT goto *jump_table[(++fentry)->code]
> +
> + /* Dispatch the first instruction */
> + goto *jump_table[fentry->code];
This is the killer, as this cannot be predicted by the cpu.
Do you have benchmark results to provide ?
We now have BPF JIT on x86_64 and powerpc, and possibly on MIPS and ARM
on a near future.
--
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