xref: /linux/include/linux/page_owner.h (revision 46d44d09)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __LINUX_PAGE_OWNER_H
3 #define __LINUX_PAGE_OWNER_H
4 
5 #include <linux/jump_label.h>
6 
7 #ifdef CONFIG_PAGE_OWNER
8 extern struct static_key_false page_owner_inited;
9 extern struct page_ext_operations page_owner_ops;
10 
11 extern void __reset_page_owner(struct page *page, unsigned short order);
12 extern void __set_page_owner(struct page *page,
13 			unsigned short order, gfp_t gfp_mask);
14 extern void __split_page_owner(struct page *page, int old_order,
15 			int new_order);
16 extern void __folio_copy_owner(struct folio *newfolio, struct folio *old);
17 extern void __set_page_owner_migrate_reason(struct page *page, int reason);
18 extern void __dump_page_owner(const struct page *page);
19 extern void pagetypeinfo_showmixedcount_print(struct seq_file *m,
20 					pg_data_t *pgdat, struct zone *zone);
21 
reset_page_owner(struct page * page,unsigned short order)22 static inline void reset_page_owner(struct page *page, unsigned short order)
23 {
24 	if (static_branch_unlikely(&page_owner_inited))
25 		__reset_page_owner(page, order);
26 }
27 
set_page_owner(struct page * page,unsigned short order,gfp_t gfp_mask)28 static inline void set_page_owner(struct page *page,
29 			unsigned short order, gfp_t gfp_mask)
30 {
31 	if (static_branch_unlikely(&page_owner_inited))
32 		__set_page_owner(page, order, gfp_mask);
33 }
34 
split_page_owner(struct page * page,int old_order,int new_order)35 static inline void split_page_owner(struct page *page, int old_order,
36 			int new_order)
37 {
38 	if (static_branch_unlikely(&page_owner_inited))
39 		__split_page_owner(page, old_order, new_order);
40 }
folio_copy_owner(struct folio * newfolio,struct folio * old)41 static inline void folio_copy_owner(struct folio *newfolio, struct folio *old)
42 {
43 	if (static_branch_unlikely(&page_owner_inited))
44 		__folio_copy_owner(newfolio, old);
45 }
set_page_owner_migrate_reason(struct page * page,int reason)46 static inline void set_page_owner_migrate_reason(struct page *page, int reason)
47 {
48 	if (static_branch_unlikely(&page_owner_inited))
49 		__set_page_owner_migrate_reason(page, reason);
50 }
dump_page_owner(const struct page * page)51 static inline void dump_page_owner(const struct page *page)
52 {
53 	if (static_branch_unlikely(&page_owner_inited))
54 		__dump_page_owner(page);
55 }
56 #else
reset_page_owner(struct page * page,unsigned short order)57 static inline void reset_page_owner(struct page *page, unsigned short order)
58 {
59 }
set_page_owner(struct page * page,unsigned short order,gfp_t gfp_mask)60 static inline void set_page_owner(struct page *page,
61 			unsigned short order, gfp_t gfp_mask)
62 {
63 }
split_page_owner(struct page * page,int old_order,int new_order)64 static inline void split_page_owner(struct page *page, int old_order,
65 			int new_order)
66 {
67 }
folio_copy_owner(struct folio * newfolio,struct folio * folio)68 static inline void folio_copy_owner(struct folio *newfolio, struct folio *folio)
69 {
70 }
set_page_owner_migrate_reason(struct page * page,int reason)71 static inline void set_page_owner_migrate_reason(struct page *page, int reason)
72 {
73 }
dump_page_owner(const struct page * page)74 static inline void dump_page_owner(const struct page *page)
75 {
76 }
77 #endif /* CONFIG_PAGE_OWNER */
78 #endif /* __LINUX_PAGE_OWNER_H */
79