[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1276499096.2478.25.camel@edumazet-laptop>
Date: Mon, 14 Jun 2010 09:04:56 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Changli Gao <xiaosuo@...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
>
> Without this branch. prev needs to be initialized to zero again(of
> course, we can avoid this by moving prev = NULL in the previous
> branch). next needs an assignment, and a duplicate check if the the
> queue is empty, which is already known in the above branch. Sorry, but
> I can't see which path I slow.
>
> prev = NULL;
> for (next = qp->q.fragments; next != NULL; next = next->next) {
> if (FRAG_CB(next)->offset >= offset)
> break; /* bingo! */
> prev = next;
> }
>
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;
--
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