* [PATCH net-next] net: skb_peek()/skb_peek_tail() cleanups
@ 2012-05-01 2:31 Eric Dumazet
2012-05-01 13:41 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2012-05-01 2:31 UTC (permalink / raw)
To: David Miller; +Cc: netdev
From: Eric Dumazet <edumazet@google.com>
remove useless casts and rename variables for less confusion.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
include/linux/skbuff.h | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 2c75e98..988fc49 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -883,10 +883,11 @@ static inline struct sk_buff *skb_unshare(struct sk_buff *skb,
*/
static inline struct sk_buff *skb_peek(const struct sk_buff_head *list_)
{
- struct sk_buff *list = ((const struct sk_buff *)list_)->next;
- if (list == (struct sk_buff *)list_)
- list = NULL;
- return list;
+ struct sk_buff *skb = list_->next;
+
+ if (skb == (struct sk_buff *)list_)
+ skb = NULL;
+ return skb;
}
/**
@@ -902,6 +903,7 @@ static inline struct sk_buff *skb_peek_next(struct sk_buff *skb,
const struct sk_buff_head *list_)
{
struct sk_buff *next = skb->next;
+
if (next == (struct sk_buff *)list_)
next = NULL;
return next;
@@ -922,10 +924,12 @@ static inline struct sk_buff *skb_peek_next(struct sk_buff *skb,
*/
static inline struct sk_buff *skb_peek_tail(const struct sk_buff_head *list_)
{
- struct sk_buff *list = ((const struct sk_buff *)list_)->prev;
- if (list == (struct sk_buff *)list_)
- list = NULL;
- return list;
+ struct sk_buff *skb = list_->prev;
+
+ if (skb == (struct sk_buff *)list_)
+ skb = NULL;
+ return skb;
+
}
/**
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: skb_peek()/skb_peek_tail() cleanups
2012-05-01 2:31 [PATCH net-next] net: skb_peek()/skb_peek_tail() cleanups Eric Dumazet
@ 2012-05-01 13:41 ` David Miller
2012-05-04 13:01 ` Eric Dumazet
0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2012-05-01 13:41 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 01 May 2012 04:31:46 +0200
> From: Eric Dumazet <edumazet@google.com>
>
> remove useless casts and rename variables for less confusion.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied, I really need to get back to completing the list_head
conversion :-/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: skb_peek()/skb_peek_tail() cleanups
2012-05-01 13:41 ` David Miller
@ 2012-05-04 13:01 ` Eric Dumazet
2012-05-04 14:52 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2012-05-04 13:01 UTC (permalink / raw)
To: David Miller; +Cc: netdev
On Tue, 2012-05-01 at 09:41 -0400, David Miller wrote:
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Tue, 01 May 2012 04:31:46 +0200
>
> > From: Eric Dumazet <edumazet@google.com>
> >
> > remove useless casts and rename variables for less confusion.
> >
> > Signed-off-by: Eric Dumazet <edumazet@google.com>
>
> Applied, I really need to get back to completing the list_head
> conversion :-/
Actually doubly linked lists everywhere has a performance issue.
When we dequeue one skb, we must bring in cpu cache the next skb as
well, to perform the unlink.
In some places it would be better to not have a double linked list, and
only perform a prefetch(skb->next).
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: skb_peek()/skb_peek_tail() cleanups
2012-05-04 13:01 ` Eric Dumazet
@ 2012-05-04 14:52 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2012-05-04 14:52 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 04 May 2012 15:01:31 +0200
> On Tue, 2012-05-01 at 09:41 -0400, David Miller wrote:
>> From: Eric Dumazet <eric.dumazet@gmail.com>
>> Date: Tue, 01 May 2012 04:31:46 +0200
>>
>> > From: Eric Dumazet <edumazet@google.com>
>> >
>> > remove useless casts and rename variables for less confusion.
>> >
>> > Signed-off-by: Eric Dumazet <edumazet@google.com>
>>
>> Applied, I really need to get back to completing the list_head
>> conversion :-/
>
> Actually doubly linked lists everywhere has a performance issue.
>
> When we dequeue one skb, we must bring in cpu cache the next skb as
> well, to perform the unlink.
>
> In some places it would be better to not have a double linked list, and
> only perform a prefetch(skb->next).
Indeed, I'll keep this in mind.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-05-04 14:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-01 2:31 [PATCH net-next] net: skb_peek()/skb_peek_tail() cleanups Eric Dumazet
2012-05-01 13:41 ` David Miller
2012-05-04 13:01 ` Eric Dumazet
2012-05-04 14:52 ` David 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).