From: Eric Dumazet <eric.dumazet@gmail.com>
To: Rui Ueyama <rui314@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] net: filter: Convert the BPF VM to threaded code
Date: Fri, 29 Jul 2011 11:30:16 +0200 [thread overview]
Message-ID: <1311931816.2843.3.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC> (raw)
In-Reply-To: <CACKH++ZfNTB7Y8YhvQnZPEXpwmpWXzxQgnWniamDrjRWUwxaNw@mail.gmail.com>
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.
next prev parent reply other threads:[~2011-07-29 9:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-29 8:10 [PATCH] net: filter: Convert the BPF VM to threaded code Rui Ueyama
2011-07-29 9:30 ` Eric Dumazet [this message]
2011-07-30 5:09 ` Rui Ueyama
2011-07-30 6:04 ` Eric Dumazet
2011-07-30 6:20 ` Eric Dumazet
2011-07-30 9:55 ` Francois Romieu
2011-08-01 18:16 ` Hagen Paul Pfeifer
2011-08-01 18:37 ` Eric Dumazet
2011-08-02 0:57 ` David Miller
2011-08-09 5:00 ` Eric Dumazet
2011-08-09 8:29 ` Hagen Paul Pfeifer
2011-08-09 8:36 ` Eric Dumazet
2011-08-09 8:53 ` Hagen Paul Pfeifer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1311931816.2843.3.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC \
--to=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=rui314@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox