Lines Matching refs:type

57  * valid_type() - Check if @type is valid or not.
58 * @type: misc res type.
62 * * true - If valid type.
63 * * false - If not valid type.
65 static inline bool valid_type(enum misc_res_type type)
67 return type >= 0 && type < MISC_CG_RES_TYPES;
72 * @type: misc res type.
77 u64 misc_cg_res_total_usage(enum misc_res_type type)
79 if (valid_type(type))
80 return atomic64_read(&root_cg.res[type].usage);
88 * @type: Type of the misc res.
91 * If capacity is 0 then the charging a misc cgroup fails for that type.
96 * * %-EINVAL - If @type is invalid.
98 int misc_cg_set_capacity(enum misc_res_type type, u64 capacity)
100 if (!valid_type(type))
103 WRITE_ONCE(misc_res_capacity[type], capacity);
110 * @type: Misc res type in misc cg to cancel the charge from.
116 static void misc_cg_cancel_charge(enum misc_res_type type, struct misc_cg *cg,
119 WARN_ONCE(atomic64_add_negative(-amount, &cg->res[type].usage),
121 misc_res_name[type]);
126 * @type: Misc res type to charge.
136 * * -EINVAL - If @type is invalid or misc res has 0 capacity.
140 int misc_cg_try_charge(enum misc_res_type type, struct misc_cg *cg, u64 amount)
147 if (!(valid_type(type) && cg && READ_ONCE(misc_res_capacity[type])))
154 res = &i->res[type];
158 new_usage > READ_ONCE(misc_res_capacity[type])) {
167 atomic64_inc(&j->res[type].events);
172 misc_cg_cancel_charge(type, j, amount);
173 misc_cg_cancel_charge(type, i, amount);
180 * @type: Misc res type which was charged.
186 void misc_cg_uncharge(enum misc_res_type type, struct misc_cg *cg, u64 amount)
190 if (!(amount && valid_type(type) && cg))
194 misc_cg_cancel_charge(type, i, amount);
250 enum misc_res_type type = MISC_CG_RES_TYPES;
261 type = i;
266 if (type == MISC_CG_RES_TYPES)
279 if (READ_ONCE(misc_res_capacity[type]))
280 WRITE_ONCE(cg->res[type].max, max);