blob: 2be728d156b5555a6331a89798bd4b0bfc2a9562 [file] [log] [blame]
Joonsoo Kim48c96a32014-12-12 16:56:01 -08001#ifndef __LINUX_PAGE_OWNER_H
2#define __LINUX_PAGE_OWNER_H
3
Vlastimil Babka7dd80b82016-03-15 14:56:12 -07004#include <linux/jump_label.h>
5
Joonsoo Kim48c96a32014-12-12 16:56:01 -08006#ifdef CONFIG_PAGE_OWNER
Vlastimil Babka7dd80b82016-03-15 14:56:12 -07007extern struct static_key_false page_owner_inited;
Joonsoo Kim48c96a32014-12-12 16:56:01 -08008extern struct page_ext_operations page_owner_ops;
9
10extern void __reset_page_owner(struct page *page, unsigned int order);
11extern void __set_page_owner(struct page *page,
12 unsigned int order, gfp_t gfp_mask);
Joonsoo Kima9627bc2016-07-26 15:23:49 -070013extern void __split_page_owner(struct page *page, unsigned int order);
Vlastimil Babkad435edc2016-03-15 14:56:15 -070014extern void __copy_page_owner(struct page *oldpage, struct page *newpage);
Vlastimil Babka7cd12b42016-03-15 14:56:18 -070015extern void __set_page_owner_migrate_reason(struct page *page, int reason);
Vlastimil Babka4e462112016-03-15 14:56:21 -070016extern void __dump_page_owner(struct page *page);
Joonsoo Kime2f612e2016-10-07 16:58:21 -070017extern void pagetypeinfo_showmixedcount_print(struct seq_file *m,
18 pg_data_t *pgdat, struct zone *zone);
Joonsoo Kim48c96a32014-12-12 16:56:01 -080019
20static inline void reset_page_owner(struct page *page, unsigned int order)
21{
Vlastimil Babka7dd80b82016-03-15 14:56:12 -070022 if (static_branch_unlikely(&page_owner_inited))
23 __reset_page_owner(page, order);
Joonsoo Kim48c96a32014-12-12 16:56:01 -080024}
25
26static inline void set_page_owner(struct page *page,
27 unsigned int order, gfp_t gfp_mask)
28{
Vlastimil Babka7dd80b82016-03-15 14:56:12 -070029 if (static_branch_unlikely(&page_owner_inited))
30 __set_page_owner(page, order, gfp_mask);
Joonsoo Kim48c96a32014-12-12 16:56:01 -080031}
Joonsoo Kime2cfc912015-07-17 16:24:18 -070032
Joonsoo Kima9627bc2016-07-26 15:23:49 -070033static inline void split_page_owner(struct page *page, unsigned int order)
Joonsoo Kime2cfc912015-07-17 16:24:18 -070034{
Vlastimil Babka7dd80b82016-03-15 14:56:12 -070035 if (static_branch_unlikely(&page_owner_inited))
Joonsoo Kima9627bc2016-07-26 15:23:49 -070036 __split_page_owner(page, order);
Joonsoo Kime2cfc912015-07-17 16:24:18 -070037}
Vlastimil Babkad435edc2016-03-15 14:56:15 -070038static inline void copy_page_owner(struct page *oldpage, struct page *newpage)
39{
40 if (static_branch_unlikely(&page_owner_inited))
41 __copy_page_owner(oldpage, newpage);
42}
Vlastimil Babka7cd12b42016-03-15 14:56:18 -070043static inline void set_page_owner_migrate_reason(struct page *page, int reason)
44{
45 if (static_branch_unlikely(&page_owner_inited))
46 __set_page_owner_migrate_reason(page, reason);
47}
Vlastimil Babka4e462112016-03-15 14:56:21 -070048static inline void dump_page_owner(struct page *page)
49{
50 if (static_branch_unlikely(&page_owner_inited))
51 __dump_page_owner(page);
52}
Joonsoo Kim48c96a32014-12-12 16:56:01 -080053#else
54static inline void reset_page_owner(struct page *page, unsigned int order)
55{
56}
57static inline void set_page_owner(struct page *page,
58 unsigned int order, gfp_t gfp_mask)
59{
60}
Joonsoo Kima9627bc2016-07-26 15:23:49 -070061static inline void split_page_owner(struct page *page,
62 unsigned int order)
Joonsoo Kime2cfc912015-07-17 16:24:18 -070063{
Joonsoo Kime2cfc912015-07-17 16:24:18 -070064}
Vlastimil Babkad435edc2016-03-15 14:56:15 -070065static inline void copy_page_owner(struct page *oldpage, struct page *newpage)
66{
67}
Vlastimil Babka7cd12b42016-03-15 14:56:18 -070068static inline void set_page_owner_migrate_reason(struct page *page, int reason)
69{
70}
Vlastimil Babka4e462112016-03-15 14:56:21 -070071static inline void dump_page_owner(struct page *page)
72{
73}
Joonsoo Kim48c96a32014-12-12 16:56:01 -080074#endif /* CONFIG_PAGE_OWNER */
75#endif /* __LINUX_PAGE_OWNER_H */