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()
140 int misc_cg_try_charge(enum misc_res_type type, struct misc_cg *cg, u64 amount) in misc_cg_try_charge() argument
147 if (!(valid_type(type) && cg && READ_ONCE(misc_res_capacity[type]))) in misc_cg_try_charge()
153 for (i = cg; i; i = parent_misc(i)) { in misc_cg_try_charge()
171 for (j = cg; j != i; j = parent_misc(j)) in misc_cg_try_charge()
186 void misc_cg_uncharge(enum misc_res_type type, struct misc_cg *cg, u64 amount) in misc_cg_uncharge() argument
190 if (!(amount && valid_type(type) && cg)) in misc_cg_uncharge()
193 for (i = cg; i; i = parent_misc(i)) in misc_cg_uncharge()
209 struct misc_cg *cg = css_misc(seq_css(sf)); in misc_cg_max_show() local
214 max = READ_ONCE(cg->res[i].max); in misc_cg_max_show()
247 struct misc_cg *cg; in misc_cg_max_write() local
277 cg = css_misc(of_css(of)); in misc_cg_max_write()
280 WRITE_ONCE(cg->res[type].max, max); in misc_cg_max_write()
299 struct misc_cg *cg = css_misc(seq_css(sf)); in misc_cg_current_show() local
302 usage = atomic64_read(&cg->res[i].usage); in misc_cg_current_show()
336 struct misc_cg *cg = css_misc(seq_css(sf)); in misc_events_show() local
341 events = atomic64_read(&cg->res[i].events); in misc_events_show()
387 struct misc_cg *cg; in misc_cg_alloc() local
390 cg = &root_cg; in misc_cg_alloc()
392 cg = kzalloc(sizeof(*cg), GFP_KERNEL); in misc_cg_alloc()
393 if (!cg) in misc_cg_alloc()
398 WRITE_ONCE(cg->res[i].max, MAX_NUM); in misc_cg_alloc()
399 atomic64_set(&cg->res[i].usage, 0); in misc_cg_alloc()
402 return &cg->css; in misc_cg_alloc()