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(atomic_long_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, in misc_cg_try_charge() argument
148 if (!(valid_type(type) && cg && READ_ONCE(misc_res_capacity[type]))) in misc_cg_try_charge()
154 for (i = cg; i; i = parent_misc(i)) { in misc_cg_try_charge()
172 for (j = cg; j != i; j = parent_misc(j)) in misc_cg_try_charge()
187 void misc_cg_uncharge(enum misc_res_type type, struct misc_cg *cg, in misc_cg_uncharge() argument
192 if (!(amount && valid_type(type) && cg)) in misc_cg_uncharge()
195 for (i = cg; i; i = parent_misc(i)) in misc_cg_uncharge()
211 struct misc_cg *cg = css_misc(seq_css(sf)); in misc_cg_max_show() local
216 max = READ_ONCE(cg->res[i].max); in misc_cg_max_show()
249 struct misc_cg *cg; in misc_cg_max_write() local
279 cg = css_misc(of_css(of)); in misc_cg_max_write()
282 WRITE_ONCE(cg->res[type].max, max); in misc_cg_max_write()
301 struct misc_cg *cg = css_misc(seq_css(sf)); in misc_cg_current_show() local
304 usage = atomic_long_read(&cg->res[i].usage); in misc_cg_current_show()
338 struct misc_cg *cg = css_misc(seq_css(sf)); in misc_events_show() local
342 events = atomic_long_read(&cg->res[i].events); in misc_events_show()
389 struct misc_cg *cg; in misc_cg_alloc() local
392 cg = &root_cg; in misc_cg_alloc()
394 cg = kzalloc(sizeof(*cg), GFP_KERNEL); in misc_cg_alloc()
395 if (!cg) in misc_cg_alloc()
400 WRITE_ONCE(cg->res[i].max, MAX_NUM); in misc_cg_alloc()
401 atomic_long_set(&cg->res[i].usage, 0); in misc_cg_alloc()
404 return &cg->css; in misc_cg_alloc()