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_direct_compact()

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

Link: https://lkml.kernel.org/r/20241125210149.2976098-10-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
8e4c8a97 df544c5e

+6 -3
+6 -3
mm/page_alloc.c
··· 3706 3706 if (page) { 3707 3707 struct zone *zone = page_zone(page); 3708 3708 3709 - set_page_refcounted(page); 3710 3709 zone->compact_blockskip_flush = false; 3711 3710 compaction_defer_reset(zone, order, true); 3712 3711 count_vm_event(COMPACTSUCCESS); ··· 4307 4308 alloc_flags, ac, 4308 4309 INIT_COMPACT_PRIORITY, 4309 4310 &compact_result); 4310 - if (page) 4311 + if (page) { 4312 + set_page_refcounted(page); 4311 4313 goto got_pg; 4314 + } 4312 4315 4313 4316 /* 4314 4317 * Checks for costly allocations with __GFP_NORETRY, which ··· 4392 4391 /* Try direct compaction and then allocating */ 4393 4392 page = __alloc_pages_direct_compact(gfp_mask, order, alloc_flags, ac, 4394 4393 compact_priority, &compact_result); 4395 - if (page) 4394 + if (page) { 4395 + set_page_refcounted(page); 4396 4396 goto got_pg; 4397 + } 4397 4398 4398 4399 /* Do not loop if specifically requested */ 4399 4400 if (gfp_mask & __GFP_NORETRY)