blob: 8679ccd722e8985b01ba113c0f472da7f25d1aa4 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Joonsoo Kim48c96a32014-12-12 16:56:01 -08002#ifndef __LINUX_PAGE_OWNER_H
3#define __LINUX_PAGE_OWNER_H
4
Vlastimil Babka7dd80b82016-03-15 14:56:12 -07005#include <linux/jump_label.h>
6
Joonsoo Kim48c96a32014-12-12 16:56:01 -08007#ifdef CONFIG_PAGE_OWNER
Vlastimil Babka7dd80b82016-03-15 14:56:12 -07008extern struct static_key_false page_owner_inited;
Joonsoo Kim48c96a32014-12-12 16:56:01 -08009extern struct page_ext_operations page_owner_ops;
10
11extern void __reset_page_owner(struct page *page, unsigned int order);
12extern void __set_page_owner(struct page *page,
13 unsigned int order, gfp_t gfp_mask);
Joonsoo Kima9627bc2016-07-26 15:23:49 -070014extern void __split_page_owner(struct page *page, unsigned int order);
Vlastimil Babkad435edc2016-03-15 14:56:15 -070015extern void __copy_page_owner(struct page *oldpage, struct page *newpage);
Vlastimil Babka7cd12b42016-03-15 14:56:18 -070016extern void __set_page_owner_migrate_reason(struct page *page, int reason);
Vlastimil Babka4e462112016-03-15 14:56:21 -070017extern void __dump_page_owner(struct page *page);
Joonsoo Kime2f612e2016-10-07 16:58:21 -070018extern void pagetypeinfo_showmixedcount_print(struct seq_file *m,
19 pg_data_t *pgdat, struct zone *zone);
Joonsoo Kim48c96a32014-12-12 16:56:01 -080020
21static inline void reset_page_owner(struct page *page, unsigned int order)
22{
Vlastimil Babka7dd80b82016-03-15 14:56:12 -070023 if (static_branch_unlikely(&page_owner_inited))
24 __reset_page_owner(page, order);
Joonsoo Kim48c96a32014-12-12 16:56:01 -080025}
26
27static inline void set_page_owner(struct page *page,
28 unsigned int order, gfp_t gfp_mask)
29{
Vlastimil Babka7dd80b82016-03-15 14:56:12 -070030 if (static_branch_unlikely(&page_owner_inited))
31 __set_page_owner(page, order, gfp_mask);
Joonsoo Kim48c96a32014-12-12 16:56:01 -080032}
Joonsoo Kime2cfc912015-07-17 16:24:18 -070033
Joonsoo Kima9627bc2016-07-26 15:23:49 -070034static inline void split_page_owner(struct page *page, unsigned int order)
Joonsoo Kime2cfc912015-07-17 16:24:18 -070035{
Vlastimil Babka7dd80b82016-03-15 14:56:12 -070036 if (static_branch_unlikely(&page_owner_inited))
Joonsoo Kima9627bc2016-07-26 15:23:49 -070037 __split_page_owner(page, order);
Joonsoo Kime2cfc912015-07-17 16:24:18 -070038}
Vlastimil Babkad435edc2016-03-15 14:56:15 -070039static inline void copy_page_owner(struct page *oldpage, struct page *newpage)
40{
41 if (static_branch_unlikely(&page_owner_inited))
42 __copy_page_owner(oldpage, newpage);
43}
Vlastimil Babka7cd12b42016-03-15 14:56:18 -070044static inline void set_page_owner_migrate_reason(struct page *page, int reason)
45{
46 if (static_branch_unlikely(&page_owner_inited))
47 __set_page_owner_migrate_reason(page, reason);
48}
Vlastimil Babka4e462112016-03-15 14:56:21 -070049static inline void dump_page_owner(struct page *page)
50{
51 if (static_branch_unlikely(&page_owner_inited))
52 __dump_page_owner(page);
53}
Joonsoo Kim48c96a32014-12-12 16:56:01 -080054#else
55static inline void reset_page_owner(struct page *page, unsigned int order)
56{
57}
58static inline void set_page_owner(struct page *page,
59 unsigned int order, gfp_t gfp_mask)
60{
61}
Joonsoo Kima9627bc2016-07-26 15:23:49 -070062static inline void split_page_owner(struct page *page,
63 unsigned int order)
Joonsoo Kime2cfc912015-07-17 16:24:18 -070064{
Joonsoo Kime2cfc912015-07-17 16:24:18 -070065}
Vlastimil Babkad435edc2016-03-15 14:56:15 -070066static inline void copy_page_owner(struct page *oldpage, struct page *newpage)
67{
68}
Vlastimil Babka7cd12b42016-03-15 14:56:18 -070069static inline void set_page_owner_migrate_reason(struct page *page, int reason)
70{
71}
Vlastimil Babka4e462112016-03-15 14:56:21 -070072static inline void dump_page_owner(struct page *page)
73{
74}
Joonsoo Kim48c96a32014-12-12 16:56:01 -080075#endif /* CONFIG_PAGE_OWNER */
76#endif /* __LINUX_PAGE_OWNER_H */