Lines Matching refs:h_cg
48 static inline bool hugetlb_cgroup_is_root(struct hugetlb_cgroup *h_cg) in hugetlb_cgroup_is_root() argument
50 return (h_cg == root_h_cgroup); in hugetlb_cgroup_is_root()
54 parent_hugetlb_cgroup(struct hugetlb_cgroup *h_cg) in parent_hugetlb_cgroup() argument
56 return hugetlb_cgroup_from_css(h_cg->css.parent); in parent_hugetlb_cgroup()
59 static inline bool hugetlb_cgroup_have_usage(struct hugetlb_cgroup *h_cg) in hugetlb_cgroup_have_usage() argument
64 if (page_counter_read(&h_cg->hugepage[idx])) in hugetlb_cgroup_have_usage()
109 static void hugetlb_cgroup_move_parent(int idx, struct hugetlb_cgroup *h_cg, in hugetlb_cgroup_move_parent() argument
115 struct hugetlb_cgroup *parent = parent_hugetlb_cgroup(h_cg); in hugetlb_cgroup_move_parent()
123 if (!page_hcg || page_hcg != h_cg) in hugetlb_cgroup_move_parent()
132 counter = &h_cg->hugepage[idx]; in hugetlb_cgroup_move_parent()
147 struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_css(css); in hugetlb_cgroup_css_offline() local
156 hugetlb_cgroup_move_parent(idx, h_cg, page); in hugetlb_cgroup_css_offline()
162 } while (hugetlb_cgroup_have_usage(h_cg)); in hugetlb_cgroup_css_offline()
170 struct hugetlb_cgroup *h_cg = NULL; in hugetlb_cgroup_charge_cgroup() local
182 h_cg = hugetlb_cgroup_from_task(current); in hugetlb_cgroup_charge_cgroup()
183 if (!css_tryget_online(&h_cg->css)) { in hugetlb_cgroup_charge_cgroup()
189 ret = page_counter_try_charge(&h_cg->hugepage[idx], nr_pages, &counter); in hugetlb_cgroup_charge_cgroup()
190 css_put(&h_cg->css); in hugetlb_cgroup_charge_cgroup()
192 *ptr = h_cg; in hugetlb_cgroup_charge_cgroup()
198 struct hugetlb_cgroup *h_cg, in hugetlb_cgroup_commit_charge() argument
201 if (hugetlb_cgroup_disabled() || !h_cg) in hugetlb_cgroup_commit_charge()
204 set_hugetlb_cgroup(page, h_cg); in hugetlb_cgroup_commit_charge()
214 struct hugetlb_cgroup *h_cg; in hugetlb_cgroup_uncharge_page() local
219 h_cg = hugetlb_cgroup_from_page(page); in hugetlb_cgroup_uncharge_page()
220 if (unlikely(!h_cg)) in hugetlb_cgroup_uncharge_page()
223 page_counter_uncharge(&h_cg->hugepage[idx], nr_pages); in hugetlb_cgroup_uncharge_page()
228 struct hugetlb_cgroup *h_cg) in hugetlb_cgroup_uncharge_cgroup() argument
230 if (hugetlb_cgroup_disabled() || !h_cg) in hugetlb_cgroup_uncharge_cgroup()
236 page_counter_uncharge(&h_cg->hugepage[idx], nr_pages); in hugetlb_cgroup_uncharge_cgroup()
251 struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_css(css); in hugetlb_cgroup_read_u64() local
253 counter = &h_cg->hugepage[MEMFILE_IDX(cft->private)]; in hugetlb_cgroup_read_u64()
276 struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_css(of_css(of)); in hugetlb_cgroup_write() local
278 if (hugetlb_cgroup_is_root(h_cg)) /* Can't set limit on root */ in hugetlb_cgroup_write()
291 ret = page_counter_limit(&h_cg->hugepage[idx], nr_pages); in hugetlb_cgroup_write()
306 struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_css(of_css(of)); in hugetlb_cgroup_reset() local
308 counter = &h_cg->hugepage[MEMFILE_IDX(of_cft(of)->private)]; in hugetlb_cgroup_reset()
400 struct hugetlb_cgroup *h_cg; in hugetlb_cgroup_migrate() local
408 h_cg = hugetlb_cgroup_from_page(oldhpage); in hugetlb_cgroup_migrate()
412 set_hugetlb_cgroup(newhpage, h_cg); in hugetlb_cgroup_migrate()