[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20100625.213604.186329332.davem@davemloft.net>
Date: Fri, 25 Jun 2010 21:36:04 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: hagen@...u.net
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH] net: optimize Berkeley Packet Filter (BPF) processing
From: Hagen Paul Pfeifer <hagen@...u.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@...u.net>
Applied.
--
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