[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <AANLkTinFc9HqkyWa9Q6k9hzEeDkjjwIyKeztvzHRx-BU@mail.gmail.com>
Date: Mon, 14 Jun 2010 18:15:28 +0800
From: Changli Gao <xiaosuo@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Alexey Kuznetsov <kuznet@....inr.ac.ru>,
"Pekka Savola (ipv6)" <pekkas@...core.fi>,
James Morris <jmorris@...ei.org>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Patrick McHardy <kaber@...sh.net>, netdev@...r.kernel.org
Subject: Re: [PATCH] fragment: add fast path
On Mon, Jun 14, 2010 at 3:04 PM, Eric Dumazet <eric.dumazet@...il.com> wrote:
>
>
> Concept of 'fast path' has changed over years. It used to be cpu
> instructions and cycles, its now number of memory transactions.
>
> The only thing we need to address are the cache lines we must bring into
> cpu caches, and keep code short.
>
> These days, one cache line miss -> more than one hundred instructions
> that could be done during cpu stall. cpu cycles are cheap if code
> already in instruction cache.
>
> Adding a test to avoid entering a NULL loop (no fragment is stored yet)
> just bloats the code, making it larger than necessary.
>
> You dont need the else branch :
>
> if (prev) {
> if (FRAG_CB(prev)->offset < offset) {
> next = NULL;
> goto found;
> }
> else {
> next = NULL;
> goto found;
> }
>
> Just write :
>
> next = NULL;
> if (prev && FRAG_CB(prev)->offset < offset)
> goto found;
>
Thanks:
I think the following code is better:
if (!prev || FRAG_CB(prev)->offset < offset) {
next = NULL;
goto found;
}
--
Regards,
Changli Gao(xiaosuo@...il.com)
--
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