Message ID | 20240607123819.40694-4-linyunsheng@huawei.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | First try to replace page_frag with page_frag_cache | expand |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 2e22ce5675ca..0511c30bc265 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4781,6 +4781,9 @@ static struct page *__page_frag_cache_refill(struct page_frag_cache *nc, gfp_t gfp = gfp_mask; #if (PAGE_SIZE < PAGE_FRAG_CACHE_MAX_SIZE) + /* Ensure free_unref_page() can be used to free the page fragment */ + BUILD_BUG_ON(PAGE_FRAG_CACHE_MAX_ORDER > PAGE_ALLOC_COSTLY_ORDER); + gfp_mask = (gfp_mask & ~__GFP_DIRECT_RECLAIM) | __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY | __GFP_NOMEMALLOC; page = alloc_pages_node(NUMA_NO_NODE, gfp_mask,
free_the_page() used by page_frag call free_unref_page() or __free_pages_ok() depending on pcp_allowed_order(), as the max order of page allocated for page_frag is 3, the checking in pcp_allowed_order() is unnecessary. So call free_unref_page() directly to free a page_frag page to aovid the unnecessary checking. As the free_the_page() is a static function in page_alloc.c, using the new one also allow moving page_frag related code to a new file in the next patch. CC: Alexander Duyck <alexander.duyck@gmail.com> Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> --- mm/page_alloc.c | 3 +++ 1 file changed, 3 insertions(+)