summaryrefslogtreecommitdiff
path: root/net/core/page_pool.c
diff options
context:
space:
mode:
authoraalexandrovich <88376726+aalexandrovich@users.noreply.github.com>2021-08-23 16:44:22 +0300
committerGitHub <noreply@github.com>2021-08-23 16:44:22 +0300
commit11e4e66efd440216032f53ee7e5ca08cd263a292 (patch)
tree630237ec37435734f29cc4ea2c91a75813d61053 /net/core/page_pool.c
parent96b18047a7172037ff4206720f4e889670030b41 (diff)
parente22ce8eb631bdc47a4a4ea7ecf4e4ba499db4f93 (diff)
Merge branch 'torvalds:master' into master
Diffstat (limited to 'net/core/page_pool.c')
-rw-r--r--net/core/page_pool.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index 5e4eb45b139c..8ab7b402244c 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -634,7 +634,15 @@ bool page_pool_return_skb_page(struct page *page)
struct page_pool *pp;
page = compound_head(page);
- if (unlikely(page->pp_magic != PP_SIGNATURE))
+
+ /* page->pp_magic is OR'ed with PP_SIGNATURE after the allocation
+ * in order to preserve any existing bits, such as bit 0 for the
+ * head page of compound page and bit 1 for pfmemalloc page, so
+ * mask those bits for freeing side when doing below checking,
+ * and page_is_pfmemalloc() is checked in __page_pool_put_page()
+ * to avoid recycling the pfmemalloc page.
+ */
+ if (unlikely((page->pp_magic & ~0x3UL) != PP_SIGNATURE))
return false;
pp = page->pp;