* [PATCH] skbuff more likely/unlikely
@ 2003-10-02 17:24 Stephen Hemminger
2003-10-03 2:34 ` Mitchell Blank Jr
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2003-10-02 17:24 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
A couple more places where we can help by hinting the compiler
for 2.6.0-test6. If we are pulling off header, is is likely there;
and skb alloc's succeed in the normal case.
Thought I saw an earlier similar patch, but here is my take on it.
diff -Nru a/include/linux/skbuff.h b/include/linux/skbuff.h
--- a/include/linux/skbuff.h Thu Oct 2 10:01:36 2003
+++ b/include/linux/skbuff.h Thu Oct 2 10:01:36 2003
@@ -885,7 +885,7 @@
*/
static inline unsigned char *skb_pull(struct sk_buff *skb, unsigned int len)
{
- return (len > skb->len) ? NULL : __skb_pull(skb, len);
+ return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len);
}
extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta);
@@ -901,7 +901,7 @@
static inline unsigned char *pskb_pull(struct sk_buff *skb, unsigned int len)
{
- return (len > skb->len) ? NULL : __pskb_pull(skb, len);
+ return unlikely(len > skb->len) ? NULL : __pskb_pull(skb, len);
}
static inline int pskb_may_pull(struct sk_buff *skb, unsigned int len)
@@ -1052,7 +1052,7 @@
int gfp_mask)
{
struct sk_buff *skb = alloc_skb(length + 16, gfp_mask);
- if (skb)
+ if (likely(skb))
skb_reserve(skb, 16);
return skb;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] skbuff more likely/unlikely
2003-10-02 17:24 [PATCH] skbuff more likely/unlikely Stephen Hemminger
@ 2003-10-03 2:34 ` Mitchell Blank Jr
2003-10-03 7:19 ` David S. Miller
0 siblings, 1 reply; 3+ messages in thread
From: Mitchell Blank Jr @ 2003-10-03 2:34 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
Stephen Hemminger wrote:
> A couple more places where we can help by hinting the compiler
> for 2.6.0-test6. If we are pulling off header, is is likely there;
> and skb alloc's succeed in the normal case.
>
> Thought I saw an earlier similar patch, but here is my take on it.
Yes, my patch from a couple weeks ago does the same thing (but also
did a lot in skbuff.c) I haven't had a chance to rediff and test
after the const parts went in. Do you want to adopt the rest of the
changes?
Original patch:
http://oss.sgi.com/projects/netdev/archive/2003-09/msg00036.html
-Mitch
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] skbuff more likely/unlikely
2003-10-03 2:34 ` Mitchell Blank Jr
@ 2003-10-03 7:19 ` David S. Miller
0 siblings, 0 replies; 3+ messages in thread
From: David S. Miller @ 2003-10-03 7:19 UTC (permalink / raw)
To: Mitchell Blank Jr; +Cc: shemminger, netdev
On Thu, 2 Oct 2003 19:34:31 -0700
Mitchell Blank Jr <mitch@sfgoth.com> wrote:
> Stephen Hemminger wrote:
> > A couple more places where we can help by hinting the compiler
> > for 2.6.0-test6. If we are pulling off header, is is likely there;
> > and skb alloc's succeed in the normal case.
> >
> > Thought I saw an earlier similar patch, but here is my take on it.
>
> Yes, my patch from a couple weeks ago does the same thing (but also
> did a lot in skbuff.c) I haven't had a chance to rediff and test
> after the const parts went in. Do you want to adopt the rest of the
> changes?
I applied Stephen's patch here, you can post something relative
to that if you like.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-10-03 7:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-02 17:24 [PATCH] skbuff more likely/unlikely Stephen Hemminger
2003-10-03 2:34 ` Mitchell Blank Jr
2003-10-03 7:19 ` David S. Miller
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).