netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Changli Gao <xiaosuo@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David Miller <davem@davemloft.net>,
	Hagen Paul Pfeifer <hagen@jauu.net>,
	netdev@vger.kernel.org
Subject: Re: [PATCH net-next-2.6 v2] filter: optimize sk_run_filter
Date: Fri, 19 Nov 2010 22:13:07 +0800	[thread overview]
Message-ID: <AANLkTimiMRL+DM+XzxLoK_zdHv_KGhbxyBRCazStpZ6c@mail.gmail.com> (raw)
In-Reply-To: <1290172607.3034.124.camel@edumazet-laptop>

On Fri, Nov 19, 2010 at 9:16 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Le vendredi 19 novembre 2010 à 20:57 +0800, Changli Gao a écrit :
>> On Fri, Nov 19, 2010 at 8:32 PM, Changli Gao <xiaosuo@gmail.com> wrote:
>> >
>> > you missed the users of sk_run_filter in directory dev/.
>> >
>>
>> Sorry, the directory is drivers/.
>>
>>
>
> You're right, thanks !
>
> [PATCH net-next-2.6 v2] filter: optimize sk_run_filter
>
> Remove pc variable to avoid arithmetic to compute fentry at each filter
> instruction. Jumps directly manipulate fentry pointer.
>
> As the last instruction of filter[] is guaranteed to be a RETURN, and
> all jumps are before the last instruction, we dont need to check filter
> bounds (number of instructions in filter array) at each iteration, so we
> remove it from sk_run_filter() params.
>
> On x86_32 remove f_k var introduced in commit 57fe93b374a6b871
> (filter: make sure filters dont read uninitialized memory)
>
> Note : We could use a CONFIG_ARCH_HAS_{FEW|MANY}_REGISTERS in order to
> avoid too many ifdefs in this code.
>
> This helps compiler to use cpu registers to hold fentry and A
> accumulator.
>
> On x86_32, this saves 401 bytes, and more important, sk_run_filter()
> runs much faster because less register pressure (One less conditional
> branch per BPF instruction)
>
> # size net/core/filter.o net/core/filter_pre.o
>   text    data     bss     dec     hex filename
>   2948       0       0    2948     b84 net/core/filter.o
>   3349       0       0    3349     d15 net/core/filter_pre.o
>
> on x86_64 :
> # size net/core/filter.o net/core/filter_pre.o
>   text    data     bss     dec     hex filename
>   5173       0       0    5173    1435 net/core/filter.o
>   5224       0       0    5224    1468 net/core/filter_pre.o
>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> Cc: Changli Gao <xiaosuo@gmail.com>
> Cc: Hagen Paul Pfeifer <hagen@jauu.net>

Acked-by: Changli Gao <xiaosuo@gmail.com>

-- 
Regards,
Changli Gao(xiaosuo@gmail.com)

  reply	other threads:[~2010-11-19 14:13 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-19  2:04 [PATCH] net: reduce the lines of code Changli Gao
2010-11-19  6:35 ` Hagen Paul Pfeifer
2010-11-19  7:17   ` Changli Gao
2010-11-19  7:51     ` Eric Dumazet
2010-11-19  7:56       ` [PATCH net-next-2.6] filter: cleanup codes[] init Eric Dumazet
2010-11-19  8:04         ` [PATCH net-next-2.6] filter: use reciprocal divide Eric Dumazet
2010-11-19  8:18           ` Changli Gao
2010-11-19 18:07             ` David Miller
2010-11-19  8:38         ` [PATCH net-next-2.6] filter: cleanup codes[] init Changli Gao
2010-11-19  9:54           ` Eric Dumazet
2010-11-19 11:17             ` [PATCH net-next-2.6] filter: optimize sk_run_filter Eric Dumazet
2010-11-19 12:32               ` Changli Gao
2010-11-19 12:57                 ` Changli Gao
2010-11-19 13:16                   ` [PATCH net-next-2.6 v2] " Eric Dumazet
2010-11-19 14:13                     ` Changli Gao [this message]
2010-11-19 17:52                       ` David Miller
2010-11-19 14:17                     ` Tetsuo Handa
2010-11-19 14:35                       ` Eric Dumazet
2010-11-19 16:21               ` [PATCH net-next-2.6] " David Miller
2010-11-19 16:55                 ` Eric Dumazet
2010-11-19 17:05                   ` David Miller
2010-11-19 17:15                     ` Stephen Hemminger
2010-11-19 17:21                       ` David Miller
2010-11-19 17:16                     ` Eric Dumazet
2010-11-19 17:25                       ` David Miller
2010-11-19 12:21             ` [PATCH net-next-2.6] filter: cleanup codes[] init Changli Gao
2010-11-19 18:07               ` David Miller

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=AANLkTimiMRL+DM+XzxLoK_zdHv_KGhbxyBRCazStpZ6c@mail.gmail.com \
    --to=xiaosuo@gmail.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --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).