This source file includes following definitions.
- hugetlb_cgroup_from_page
- set_hugetlb_cgroup
- hugetlb_cgroup_disabled
- hugetlb_cgroup_file_init
- set_hugetlb_cgroup
- hugetlb_cgroup_disabled
- hugetlb_cgroup_charge_cgroup
- hugetlb_cgroup_commit_charge
- hugetlb_cgroup_uncharge_page
- hugetlb_cgroup_uncharge_cgroup
- hugetlb_cgroup_file_init
- hugetlb_cgroup_migrate
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 #ifndef _LINUX_HUGETLB_CGROUP_H
16 #define _LINUX_HUGETLB_CGROUP_H
17
18 #include <linux/mmdebug.h>
19
20 struct hugetlb_cgroup;
21
22
23
24
25 #define HUGETLB_CGROUP_MIN_ORDER 2
26
27 #ifdef CONFIG_CGROUP_HUGETLB
28
29 static inline struct hugetlb_cgroup *hugetlb_cgroup_from_page(struct page *page)
30 {
31 VM_BUG_ON_PAGE(!PageHuge(page), page);
32
33 if (compound_order(page) < HUGETLB_CGROUP_MIN_ORDER)
34 return NULL;
35 return (struct hugetlb_cgroup *)page[2].private;
36 }
37
38 static inline
39 int set_hugetlb_cgroup(struct page *page, struct hugetlb_cgroup *h_cg)
40 {
41 VM_BUG_ON_PAGE(!PageHuge(page), page);
42
43 if (compound_order(page) < HUGETLB_CGROUP_MIN_ORDER)
44 return -1;
45 page[2].private = (unsigned long)h_cg;
46 return 0;
47 }
48
49 static inline bool hugetlb_cgroup_disabled(void)
50 {
51 return !cgroup_subsys_enabled(hugetlb_cgrp_subsys);
52 }
53
54 extern int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages,
55 struct hugetlb_cgroup **ptr);
56 extern void hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages,
57 struct hugetlb_cgroup *h_cg,
58 struct page *page);
59 extern void hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages,
60 struct page *page);
61 extern void hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages,
62 struct hugetlb_cgroup *h_cg);
63 extern void hugetlb_cgroup_file_init(void) __init;
64 extern void hugetlb_cgroup_migrate(struct page *oldhpage,
65 struct page *newhpage);
66
67 #else
68 static inline struct hugetlb_cgroup *hugetlb_cgroup_from_page(struct page *page)
69 {
70 return NULL;
71 }
72
73 static inline
74 int set_hugetlb_cgroup(struct page *page, struct hugetlb_cgroup *h_cg)
75 {
76 return 0;
77 }
78
79 static inline bool hugetlb_cgroup_disabled(void)
80 {
81 return true;
82 }
83
84 static inline int
85 hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages,
86 struct hugetlb_cgroup **ptr)
87 {
88 return 0;
89 }
90
91 static inline void
92 hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages,
93 struct hugetlb_cgroup *h_cg,
94 struct page *page)
95 {
96 }
97
98 static inline void
99 hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages, struct page *page)
100 {
101 }
102
103 static inline void
104 hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages,
105 struct hugetlb_cgroup *h_cg)
106 {
107 }
108
109 static inline void hugetlb_cgroup_file_init(void)
110 {
111 }
112
113 static inline void hugetlb_cgroup_migrate(struct page *oldhpage,
114 struct page *newhpage)
115 {
116 }
117
118 #endif
119 #endif