mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
net: introduce __skb_fill_page_desc_noacc
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>
This commit is contained in:
parent
753f1ca4e1
commit
84ce071e38
1 changed files with 17 additions and 11 deletions
|
@ -2550,6 +2550,22 @@ static inline unsigned int skb_pagelen(const struct sk_buff *skb)
|
||||||
return skb_headlen(skb) + __skb_pagelen(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_fill_page_desc - initialise a paged fragment in an skb
|
||||||
* @skb: buffer containing fragment to be initialised
|
* @skb: buffer containing fragment to be initialised
|
||||||
|
@ -2566,17 +2582,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,
|
static inline void __skb_fill_page_desc(struct sk_buff *skb, int i,
|
||||||
struct page *page, int off, int size)
|
struct page *page, int off, int size)
|
||||||
{
|
{
|
||||||
skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
|
__skb_fill_page_desc_noacc(skb_shinfo(skb), i, page, off, size);
|
||||||
|
|
||||||
/*
|
|
||||||
* 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);
|
|
||||||
|
|
||||||
page = compound_head(page);
|
page = compound_head(page);
|
||||||
if (page_is_pfmemalloc(page))
|
if (page_is_pfmemalloc(page))
|
||||||
skb->pfmemalloc = true;
|
skb->pfmemalloc = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue