blob: 30583ab0ffb1f8da50d6a3a5cd8e0277af78a304 [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 Kim48c96a32014-12-12 16:56:01 -080017
18static inline void reset_page_owner(struct page *page, unsigned int order)
19{
Vlastimil Babka7dd80b82016-03-15 14:56:12 -070020 if (static_branch_unlikely(&page_owner_inited))
21 __reset_page_owner(page, order);
Joonsoo Kim48c96a32014-12-12 16:56:01 -080022}
23
24static inline void set_page_owner(struct page *page,
25 unsigned int order, gfp_t gfp_mask)
26{
Vlastimil Babka7dd80b82016-03-15 14:56:12 -070027 if (static_branch_unlikely(&page_owner_inited))
28 __set_page_owner(page, order, gfp_mask);
Joonsoo Kim48c96a32014-12-12 16:56:01 -080029}
Joonsoo Kime2cfc912015-07-17 16:24:18 -070030
Joonsoo Kima9627bc2016-07-26 15:23:49 -070031static inline void split_page_owner(struct page *page, unsigned int order)
Joonsoo Kime2cfc912015-07-17 16:24:18 -070032{
Vlastimil Babka7dd80b82016-03-15 14:56:12 -070033 if (static_branch_unlikely(&page_owner_inited))
Joonsoo Kima9627bc2016-07-26 15:23:49 -070034 __split_page_owner(page, order);
Joonsoo Kime2cfc912015-07-17 16:24:18 -070035}
Vlastimil Babkad435edc2016-03-15 14:56:15 -070036static inline void copy_page_owner(struct page *oldpage, struct page *newpage)
37{
38 if (static_branch_unlikely(&page_owner_inited))
39 __copy_page_owner(oldpage, newpage);
40}
Vlastimil Babka7cd12b42016-03-15 14:56:18 -070041static inline void set_page_owner_migrate_reason(struct page *page, int reason)
42{
43 if (static_branch_unlikely(&page_owner_inited))
44 __set_page_owner_migrate_reason(page, reason);
45}
Vlastimil Babka4e462112016-03-15 14:56:21 -070046static inline void dump_page_owner(struct page *page)
47{
48 if (static_branch_unlikely(&page_owner_inited))
49 __dump_page_owner(page);
50}
Joonsoo Kim48c96a32014-12-12 16:56:01 -080051#else
52static inline void reset_page_owner(struct page *page, unsigned int order)
53{
54}
55static inline void set_page_owner(struct page *page,
56 unsigned int order, gfp_t gfp_mask)
57{
58}
Joonsoo Kima9627bc2016-07-26 15:23:49 -070059static inline void split_page_owner(struct page *page,
60 unsigned int order)
Joonsoo Kime2cfc912015-07-17 16:24:18 -070061{
Joonsoo Kime2cfc912015-07-17 16:24:18 -070062}
Vlastimil Babkad435edc2016-03-15 14:56:15 -070063static inline void copy_page_owner(struct page *oldpage, struct page *newpage)
64{
65}
Vlastimil Babka7cd12b42016-03-15 14:56:18 -070066static inline void set_page_owner_migrate_reason(struct page *page, int reason)
67{
68}
Vlastimil Babka4e462112016-03-15 14:56:21 -070069static inline void dump_page_owner(struct page *page)
70{
71}
Joonsoo Kim48c96a32014-12-12 16:56:01 -080072#endif /* CONFIG_PAGE_OWNER */
73#endif /* __LINUX_PAGE_OWNER_H */