]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - include/linux/skbuff.h
mm: clean up and clarify lruvec lookup procedure
[linux.git] / include / linux / skbuff.h
index 8688f7adfda71d955fb93004ade88cb80ab2c5b7..eceb3607864be4486aea308a0a2eecfabc408650 100644 (file)
@@ -1795,7 +1795,7 @@ 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 *skb = list_->prev;
+       struct sk_buff *skb = READ_ONCE(list_->prev);
 
        if (skb == (struct sk_buff *)list_)
                skb = NULL;
@@ -1861,7 +1861,9 @@ static inline void __skb_insert(struct sk_buff *newsk,
                                struct sk_buff *prev, struct sk_buff *next,
                                struct sk_buff_head *list)
 {
-       /* see skb_queue_empty_lockless() for the opposite READ_ONCE() */
+       /* See skb_queue_empty_lockless() and skb_peek_tail()
+        * for the opposite READ_ONCE()
+        */
        WRITE_ONCE(newsk->next, next);
        WRITE_ONCE(newsk->prev, prev);
        WRITE_ONCE(next->prev, newsk);
@@ -2277,12 +2279,12 @@ static inline void *pskb_pull(struct sk_buff *skb, unsigned int len)
        return unlikely(len > skb->len) ? NULL : __pskb_pull(skb, len);
 }
 
-static inline int pskb_may_pull(struct sk_buff *skb, unsigned int len)
+static inline bool pskb_may_pull(struct sk_buff *skb, unsigned int len)
 {
        if (likely(len <= skb_headlen(skb)))
-               return 1;
+               return true;
        if (unlikely(len > skb->len))
-               return 0;
+               return false;
        return __pskb_pull_tail(skb, len - skb_headlen(skb)) != NULL;
 }