Skip to content

Commit cd5f1a6

Browse files
isilencegregkh
authored andcommitted
net: introduce __skb_fill_page_desc_noacc
[ Upstream commit 84ce071 ] 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>
1 parent 7eb9bf4 commit cd5f1a6

1 file changed

Lines changed: 17 additions & 11 deletions

File tree

include/linux/skbuff.h

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2232,6 +2232,22 @@ static inline unsigned int skb_pagelen(const struct sk_buff *skb)
22322232
return skb_headlen(skb) + __skb_pagelen(skb);
22332233
}
22342234

2235+
static inline void __skb_fill_page_desc_noacc(struct skb_shared_info *shinfo,
2236+
int i, struct page *page,
2237+
int off, int size)
2238+
{
2239+
skb_frag_t *frag = &shinfo->frags[i];
2240+
2241+
/*
2242+
* Propagate page pfmemalloc to the skb if we can. The problem is
2243+
* that not all callers have unique ownership of the page but rely
2244+
* on page_is_pfmemalloc doing the right thing(tm).
2245+
*/
2246+
frag->bv_page = page;
2247+
frag->bv_offset = off;
2248+
skb_frag_size_set(frag, size);
2249+
}
2250+
22352251
/**
22362252
* __skb_fill_page_desc - initialise a paged fragment in an skb
22372253
* @skb: buffer containing fragment to be initialised
@@ -2248,17 +2264,7 @@ static inline unsigned int skb_pagelen(const struct sk_buff *skb)
22482264
static inline void __skb_fill_page_desc(struct sk_buff *skb, int i,
22492265
struct page *page, int off, int size)
22502266
{
2251-
skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
2252-
2253-
/*
2254-
* Propagate page pfmemalloc to the skb if we can. The problem is
2255-
* that not all callers have unique ownership of the page but rely
2256-
* on page_is_pfmemalloc doing the right thing(tm).
2257-
*/
2258-
frag->bv_page = page;
2259-
frag->bv_offset = off;
2260-
skb_frag_size_set(frag, size);
2261-
2267+
__skb_fill_page_desc_noacc(skb_shinfo(skb), i, page, off, size);
22622268
page = compound_head(page);
22632269
if (page_is_pfmemalloc(page))
22642270
skb->pfmemalloc = true;

0 commit comments

Comments
 (0)