Message ID | 1628213947-39384-1-git-send-email-linyunsheng@huawei.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 0fa32ca438b42fadfb293d72690e117ab3d67489 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net,V2] page_pool: mask the page->signature before the checking | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | success | CCed 6 of 6 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 1 this patch: 1 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 16 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 1 this patch: 1 |
netdev/header_inline | success | Link |
Hello: This patch was applied to netdev/net.git (refs/heads/master): On Fri, 6 Aug 2021 09:39:07 +0800 you wrote: > As mentioned in commit c07aea3ef4d4 ("mm: add a signature in > struct page"): > "The page->signature field is aliased to page->lru.next and > page->compound_head." > > And as the comment in page_is_pfmemalloc(): > "lru.next has bit 1 set if the page is allocated from the > pfmemalloc reserves. Callers may simply overwrite it if they > do not need to preserve that information." > > [...] Here is the summary with links: - [net,V2] page_pool: mask the page->signature before the checking https://git.kernel.org/netdev/net/c/0fa32ca438b4 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
diff --git a/net/core/page_pool.c b/net/core/page_pool.c index 5e4eb45..8ab7b40 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;