Joonsoo Kim | 48c96a3 | 2014-12-12 16:56:01 -0800 | [diff] [blame] | 1 | #ifndef __LINUX_PAGE_OWNER_H |
| 2 | #define __LINUX_PAGE_OWNER_H |
| 3 | |
Vlastimil Babka | 7dd80b8 | 2016-03-15 14:56:12 -0700 | [diff] [blame] | 4 | #include <linux/jump_label.h> |
| 5 | |
Joonsoo Kim | 48c96a3 | 2014-12-12 16:56:01 -0800 | [diff] [blame] | 6 | #ifdef CONFIG_PAGE_OWNER |
Vlastimil Babka | 7dd80b8 | 2016-03-15 14:56:12 -0700 | [diff] [blame] | 7 | extern struct static_key_false page_owner_inited; |
Joonsoo Kim | 48c96a3 | 2014-12-12 16:56:01 -0800 | [diff] [blame] | 8 | extern struct page_ext_operations page_owner_ops; |
| 9 | |
| 10 | extern void __reset_page_owner(struct page *page, unsigned int order); |
| 11 | extern void __set_page_owner(struct page *page, |
| 12 | unsigned int order, gfp_t gfp_mask); |
Joonsoo Kim | a9627bc | 2016-07-26 15:23:49 -0700 | [diff] [blame^] | 13 | extern void __split_page_owner(struct page *page, unsigned int order); |
Vlastimil Babka | d435edc | 2016-03-15 14:56:15 -0700 | [diff] [blame] | 14 | extern void __copy_page_owner(struct page *oldpage, struct page *newpage); |
Vlastimil Babka | 7cd12b4 | 2016-03-15 14:56:18 -0700 | [diff] [blame] | 15 | extern void __set_page_owner_migrate_reason(struct page *page, int reason); |
Vlastimil Babka | 4e46211 | 2016-03-15 14:56:21 -0700 | [diff] [blame] | 16 | extern void __dump_page_owner(struct page *page); |
Joonsoo Kim | 48c96a3 | 2014-12-12 16:56:01 -0800 | [diff] [blame] | 17 | |
| 18 | static inline void reset_page_owner(struct page *page, unsigned int order) |
| 19 | { |
Vlastimil Babka | 7dd80b8 | 2016-03-15 14:56:12 -0700 | [diff] [blame] | 20 | if (static_branch_unlikely(&page_owner_inited)) |
| 21 | __reset_page_owner(page, order); |
Joonsoo Kim | 48c96a3 | 2014-12-12 16:56:01 -0800 | [diff] [blame] | 22 | } |
| 23 | |
| 24 | static inline void set_page_owner(struct page *page, |
| 25 | unsigned int order, gfp_t gfp_mask) |
| 26 | { |
Vlastimil Babka | 7dd80b8 | 2016-03-15 14:56:12 -0700 | [diff] [blame] | 27 | if (static_branch_unlikely(&page_owner_inited)) |
| 28 | __set_page_owner(page, order, gfp_mask); |
Joonsoo Kim | 48c96a3 | 2014-12-12 16:56:01 -0800 | [diff] [blame] | 29 | } |
Joonsoo Kim | e2cfc91 | 2015-07-17 16:24:18 -0700 | [diff] [blame] | 30 | |
Joonsoo Kim | a9627bc | 2016-07-26 15:23:49 -0700 | [diff] [blame^] | 31 | static inline void split_page_owner(struct page *page, unsigned int order) |
Joonsoo Kim | e2cfc91 | 2015-07-17 16:24:18 -0700 | [diff] [blame] | 32 | { |
Vlastimil Babka | 7dd80b8 | 2016-03-15 14:56:12 -0700 | [diff] [blame] | 33 | if (static_branch_unlikely(&page_owner_inited)) |
Joonsoo Kim | a9627bc | 2016-07-26 15:23:49 -0700 | [diff] [blame^] | 34 | __split_page_owner(page, order); |
Joonsoo Kim | e2cfc91 | 2015-07-17 16:24:18 -0700 | [diff] [blame] | 35 | } |
Vlastimil Babka | d435edc | 2016-03-15 14:56:15 -0700 | [diff] [blame] | 36 | static 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 Babka | 7cd12b4 | 2016-03-15 14:56:18 -0700 | [diff] [blame] | 41 | static 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 Babka | 4e46211 | 2016-03-15 14:56:21 -0700 | [diff] [blame] | 46 | static inline void dump_page_owner(struct page *page) |
| 47 | { |
| 48 | if (static_branch_unlikely(&page_owner_inited)) |
| 49 | __dump_page_owner(page); |
| 50 | } |
Joonsoo Kim | 48c96a3 | 2014-12-12 16:56:01 -0800 | [diff] [blame] | 51 | #else |
| 52 | static inline void reset_page_owner(struct page *page, unsigned int order) |
| 53 | { |
| 54 | } |
| 55 | static inline void set_page_owner(struct page *page, |
| 56 | unsigned int order, gfp_t gfp_mask) |
| 57 | { |
| 58 | } |
Joonsoo Kim | a9627bc | 2016-07-26 15:23:49 -0700 | [diff] [blame^] | 59 | static inline void split_page_owner(struct page *page, |
| 60 | unsigned int order) |
Joonsoo Kim | e2cfc91 | 2015-07-17 16:24:18 -0700 | [diff] [blame] | 61 | { |
Joonsoo Kim | e2cfc91 | 2015-07-17 16:24:18 -0700 | [diff] [blame] | 62 | } |
Vlastimil Babka | d435edc | 2016-03-15 14:56:15 -0700 | [diff] [blame] | 63 | static inline void copy_page_owner(struct page *oldpage, struct page *newpage) |
| 64 | { |
| 65 | } |
Vlastimil Babka | 7cd12b4 | 2016-03-15 14:56:18 -0700 | [diff] [blame] | 66 | static inline void set_page_owner_migrate_reason(struct page *page, int reason) |
| 67 | { |
| 68 | } |
Vlastimil Babka | 4e46211 | 2016-03-15 14:56:21 -0700 | [diff] [blame] | 69 | static inline void dump_page_owner(struct page *page) |
| 70 | { |
| 71 | } |
Joonsoo Kim | 48c96a3 | 2014-12-12 16:56:01 -0800 | [diff] [blame] | 72 | #endif /* CONFIG_PAGE_OWNER */ |
| 73 | #endif /* __LINUX_PAGE_OWNER_H */ |