Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/page_alloc: move set_page_refcounted() to callers of __alloc_pages_cpuset_fallback()

In preparation for allocating frozen pages, stop initialising the page
refcount in __alloc_pages_cpuset_fallback().

Link: https://lkml.kernel.org/r/20241125210149.2976098-8-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Cc: David Hildenbrand <david@redhat.com>
Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Muchun Song <songmuchun@bytedance.com>
Cc: William Kucharski <william.kucharski@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Matthew Wilcox (Oracle) and committed by
Andrew Morton
4c9017cc efabfe14

+5 -4
+5 -4
mm/page_alloc.c
··· 3566 3566 if (!page) 3567 3567 page = get_page_from_freelist(gfp_mask, order, 3568 3568 alloc_flags, ac); 3569 - 3570 - if (page) 3571 - set_page_refcounted(page); 3572 3569 return page; 3573 3570 } 3574 3571 ··· 3652 3655 if (gfp_mask & __GFP_NOFAIL) 3653 3656 page = __alloc_pages_cpuset_fallback(gfp_mask, order, 3654 3657 ALLOC_NO_WATERMARKS, ac); 3658 + if (page) 3659 + set_page_refcounted(page); 3655 3660 } 3656 3661 out: 3657 3662 mutex_unlock(&oom_lock); ··· 4482 4483 * the situation worse. 4483 4484 */ 4484 4485 page = __alloc_pages_cpuset_fallback(gfp_mask, order, ALLOC_MIN_RESERVE, ac); 4485 - if (page) 4486 + if (page) { 4487 + set_page_refcounted(page); 4486 4488 goto got_pg; 4489 + } 4487 4490 4488 4491 cond_resched(); 4489 4492 goto retry;