Lines Matching refs:cg
116 static void misc_cg_cancel_charge(enum misc_res_type type, struct misc_cg *cg, in misc_cg_cancel_charge() argument
119 WARN_ONCE(atomic64_add_negative(-amount, &cg->res[type].usage), in misc_cg_cancel_charge()
137 static void misc_cg_event(enum misc_res_type type, struct misc_cg *cg) in misc_cg_event() argument
139 atomic64_inc(&cg->res[type].events_local); in misc_cg_event()
140 cgroup_file_notify(&cg->events_local_file); in misc_cg_event()
142 for (; parent_misc(cg); cg = parent_misc(cg)) { in misc_cg_event()
143 atomic64_inc(&cg->res[type].events); in misc_cg_event()
144 cgroup_file_notify(&cg->events_file); in misc_cg_event()
164 int misc_cg_try_charge(enum misc_res_type type, struct misc_cg *cg, u64 amount) in misc_cg_try_charge() argument
171 if (!(valid_type(type) && cg && READ_ONCE(misc_res_capacity[type]))) in misc_cg_try_charge()
177 for (i = cg; i; i = parent_misc(i)) { in misc_cg_try_charge()
193 for (j = cg; j != i; j = parent_misc(j)) in misc_cg_try_charge()
208 void misc_cg_uncharge(enum misc_res_type type, struct misc_cg *cg, u64 amount) in misc_cg_uncharge() argument
212 if (!(amount && valid_type(type) && cg)) in misc_cg_uncharge()
215 for (i = cg; i; i = parent_misc(i)) in misc_cg_uncharge()
231 struct misc_cg *cg = css_misc(seq_css(sf)); in misc_cg_max_show() local
236 max = READ_ONCE(cg->res[i].max); in misc_cg_max_show()
269 struct misc_cg *cg; in misc_cg_max_write() local
299 cg = css_misc(of_css(of)); in misc_cg_max_write()
302 WRITE_ONCE(cg->res[type].max, max); in misc_cg_max_write()
321 struct misc_cg *cg = css_misc(seq_css(sf)); in misc_cg_current_show() local
324 usage = atomic64_read(&cg->res[i].usage); in misc_cg_current_show()
344 struct misc_cg *cg = css_misc(seq_css(sf)); in misc_cg_peak_show() local
347 watermark = atomic64_read(&cg->res[i].watermark); in misc_cg_peak_show()
381 struct misc_cg *cg = css_misc(seq_css(sf)); in __misc_events_show() local
387 events = atomic64_read(&cg->res[i].events_local); in __misc_events_show()
389 events = atomic64_read(&cg->res[i].events); in __misc_events_show()
455 struct misc_cg *cg; in misc_cg_alloc() local
458 cg = &root_cg; in misc_cg_alloc()
460 cg = kzalloc(sizeof(*cg), GFP_KERNEL); in misc_cg_alloc()
461 if (!cg) in misc_cg_alloc()
466 WRITE_ONCE(cg->res[i].max, MAX_NUM); in misc_cg_alloc()
467 atomic64_set(&cg->res[i].usage, 0); in misc_cg_alloc()
470 return &cg->css; in misc_cg_alloc()