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