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: add __alloc_frozen_pages()

Defer the initialisation of the page refcount to the new __alloc_pages()
wrapper and turn the old __alloc_pages() into __alloc_frozen_pages().

Link: https://lkml.kernel.org/r/20241125210149.2976098-14-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
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
49249a2a c972106d

+18 -4
+4
mm/internal.h
··· 740 740 741 741 extern int user_min_free_kbytes; 742 742 743 + struct page *__alloc_frozen_pages_noprof(gfp_t, unsigned int order, int nid, 744 + nodemask_t *); 745 + #define __alloc_frozen_pages(...) \ 746 + alloc_hooks(__alloc_frozen_pages_noprof(__VA_ARGS__)) 743 747 void free_frozen_pages(struct page *page, unsigned int order); 744 748 void free_unref_folios(struct folio_batch *fbatch); 745 749
+14 -4
mm/page_alloc.c
··· 4713 4713 /* 4714 4714 * This is the 'heart' of the zoned buddy allocator. 4715 4715 */ 4716 - struct page *__alloc_pages_noprof(gfp_t gfp, unsigned int order, 4717 - int preferred_nid, nodemask_t *nodemask) 4716 + struct page *__alloc_frozen_pages_noprof(gfp_t gfp, unsigned int order, 4717 + int preferred_nid, nodemask_t *nodemask) 4718 4718 { 4719 4719 struct page *page; 4720 4720 unsigned int alloc_flags = ALLOC_WMARK_LOW; ··· 4770 4770 free_frozen_pages(page, order); 4771 4771 page = NULL; 4772 4772 } 4773 - if (page) 4774 - set_page_refcounted(page); 4775 4773 4776 4774 trace_mm_page_alloc(page, order, alloc_gfp, ac.migratetype); 4777 4775 kmsan_alloc_page(page, order, alloc_gfp); 4778 4776 4777 + return page; 4778 + } 4779 + EXPORT_SYMBOL(__alloc_frozen_pages_noprof); 4780 + 4781 + struct page *__alloc_pages_noprof(gfp_t gfp, unsigned int order, 4782 + int preferred_nid, nodemask_t *nodemask) 4783 + { 4784 + struct page *page; 4785 + 4786 + page = __alloc_frozen_pages_noprof(gfp, order, preferred_nid, nodemask); 4787 + if (page) 4788 + set_page_refcounted(page); 4779 4789 return page; 4780 4790 } 4781 4791 EXPORT_SYMBOL(__alloc_pages_noprof);