Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[firefly-linux-kernel-4.4.55.git] / include / linux / page_owner.h
1 #ifndef __LINUX_PAGE_OWNER_H
2 #define __LINUX_PAGE_OWNER_H
3
4 #ifdef CONFIG_PAGE_OWNER
5 extern bool page_owner_inited;
6 extern struct page_ext_operations page_owner_ops;
7
8 extern void __reset_page_owner(struct page *page, unsigned int order);
9 extern void __set_page_owner(struct page *page,
10                         unsigned int order, gfp_t gfp_mask);
11 extern gfp_t __get_page_owner_gfp(struct page *page);
12
13 static inline void reset_page_owner(struct page *page, unsigned int order)
14 {
15         if (likely(!page_owner_inited))
16                 return;
17
18         __reset_page_owner(page, order);
19 }
20
21 static inline void set_page_owner(struct page *page,
22                         unsigned int order, gfp_t gfp_mask)
23 {
24         if (likely(!page_owner_inited))
25                 return;
26
27         __set_page_owner(page, order, gfp_mask);
28 }
29
30 static inline gfp_t get_page_owner_gfp(struct page *page)
31 {
32         if (likely(!page_owner_inited))
33                 return 0;
34
35         return __get_page_owner_gfp(page);
36 }
37 #else
38 static inline void reset_page_owner(struct page *page, unsigned int order)
39 {
40 }
41 static inline void set_page_owner(struct page *page,
42                         unsigned int order, gfp_t gfp_mask)
43 {
44 }
45 static inline gfp_t get_page_owner_gfp(struct page *page)
46 {
47         return 0;
48 }
49
50 #endif /* CONFIG_PAGE_OWNER */
51 #endif /* __LINUX_PAGE_OWNER_H */