lkml.org 
[lkml]   [2022]   [Sep]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.15 079/121] net: introduce __skb_fill_page_desc_noacc
    Date
    From: Pavel Begunkov <asml.silence@gmail.com>

    [ Upstream commit 84ce071e38a6e25ea3ea91188e5482ac1f17b3af ]

    Managed pages contain pinned userspace pages and controlled by upper
    layers, there is no need in tracking skb->pfmemalloc for them. Introduce
    a helper for filling frags but ignoring page tracking, it'll be needed
    later.

    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    include/linux/skbuff.h | 28 +++++++++++++++++-----------
    1 file changed, 17 insertions(+), 11 deletions(-)

    diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
    index ae598ed86b50b..be7cc31d58961 100644
    --- a/include/linux/skbuff.h
    +++ b/include/linux/skbuff.h
    @@ -2232,6 +2232,22 @@ static inline unsigned int skb_pagelen(const struct sk_buff *skb)
    return skb_headlen(skb) + __skb_pagelen(skb);
    }

    +static inline void __skb_fill_page_desc_noacc(struct skb_shared_info *shinfo,
    + int i, struct page *page,
    + int off, int size)
    +{
    + skb_frag_t *frag = &shinfo->frags[i];
    +
    + /*
    + * Propagate page pfmemalloc to the skb if we can. The problem is
    + * that not all callers have unique ownership of the page but rely
    + * on page_is_pfmemalloc doing the right thing(tm).
    + */
    + frag->bv_page = page;
    + frag->bv_offset = off;
    + skb_frag_size_set(frag, size);
    +}
    +
    /**
    * __skb_fill_page_desc - initialise a paged fragment in an skb
    * @skb: buffer containing fragment to be initialised
    @@ -2248,17 +2264,7 @@ static inline unsigned int skb_pagelen(const struct sk_buff *skb)
    static inline void __skb_fill_page_desc(struct sk_buff *skb, int i,
    struct page *page, int off, int size)
    {
    - skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
    -
    - /*
    - * Propagate page pfmemalloc to the skb if we can. The problem is
    - * that not all callers have unique ownership of the page but rely
    - * on page_is_pfmemalloc doing the right thing(tm).
    - */
    - frag->bv_page = page;
    - frag->bv_offset = off;
    - skb_frag_size_set(frag, size);
    -
    + __skb_fill_page_desc_noacc(skb_shinfo(skb), i, page, off, size);
    page = compound_head(page);
    if (page_is_pfmemalloc(page))
    skb->pfmemalloc = true;
    --
    2.35.1


    \
     
     \ /
      Last update: 2022-09-13 16:40    [W:3.323 / U:0.812 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site