From: David Miller <davem@davemloft.net>
To: hagen@jauu.net
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] net: optimize Berkeley Packet Filter (BPF) processing
Date: Fri, 25 Jun 2010 21:36:04 -0700 (PDT) [thread overview]
Message-ID: <20100625.213604.186329332.davem@davemloft.net> (raw)
In-Reply-To: <1277003136-5522-1-git-send-email-hagen@jauu.net>
From: Hagen Paul Pfeifer <hagen@jauu.net>
Date: Sun, 20 Jun 2010 05:05:36 +0200
> Gcc is currenlty not in the ability to optimize the switch statement in
> sk_run_filter() because of dense case labels. This patch replace the
> OR'd labels with ordered sequenced case labels. The sk_chk_filter()
> function is modified to patch/replace the original OPCODES in a
> ordered but equivalent form. gcc is now in the ability to transform the
> switch statement in sk_run_filter into a jump table of complexity O(1).
>
> Until this patch gcc generates a sequence of conditional branches (O(n) of 567
> byte .text segment size (arch x86_64):
...
> With the modification the compiler translate the switch statement into
> the following jump table fragment:
...
> Furthermore, I reordered the instructions to reduce cache line misses by
> order the most common instruction to the start.
>
> Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>
Applied.
prev parent reply other threads:[~2010-06-26 4:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-20 3:05 [PATCH] net: optimize Berkeley Packet Filter (BPF) processing Hagen Paul Pfeifer
2010-06-20 5:16 ` Stephen Hemminger
2010-06-20 9:50 ` Hagen Paul Pfeifer
2010-06-20 18:49 ` Stephen Hemminger
2010-06-20 22:09 ` David Miller
2010-06-20 21:57 ` Hagen Paul Pfeifer
2010-06-21 2:15 ` Changli Gao
2010-06-21 7:57 ` Hagen Paul Pfeifer
2010-06-26 4:36 ` David Miller [this message]
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=20100625.213604.186329332.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=hagen@jauu.net \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).