Lines Matching refs:objagg_obj

54 struct objagg_obj {  struct
57 struct objagg_obj *parent; /* if the object is nested, this argument
72 static unsigned int objagg_obj_ref_inc(struct objagg_obj *objagg_obj) in objagg_obj_ref_inc() argument
74 return ++objagg_obj->refcount; in objagg_obj_ref_inc()
77 static unsigned int objagg_obj_ref_dec(struct objagg_obj *objagg_obj) in objagg_obj_ref_dec() argument
79 return --objagg_obj->refcount; in objagg_obj_ref_dec()
82 static void objagg_obj_stats_inc(struct objagg_obj *objagg_obj) in objagg_obj_stats_inc() argument
84 objagg_obj->stats.user_count++; in objagg_obj_stats_inc()
85 objagg_obj->stats.delta_user_count++; in objagg_obj_stats_inc()
86 if (objagg_obj->parent) in objagg_obj_stats_inc()
87 objagg_obj->parent->stats.delta_user_count++; in objagg_obj_stats_inc()
90 static void objagg_obj_stats_dec(struct objagg_obj *objagg_obj) in objagg_obj_stats_dec() argument
92 objagg_obj->stats.user_count--; in objagg_obj_stats_dec()
93 objagg_obj->stats.delta_user_count--; in objagg_obj_stats_dec()
94 if (objagg_obj->parent) in objagg_obj_stats_dec()
95 objagg_obj->parent->stats.delta_user_count--; in objagg_obj_stats_dec()
98 static bool objagg_obj_is_root(const struct objagg_obj *objagg_obj) in objagg_obj_is_root() argument
103 return !objagg_obj->parent; in objagg_obj_is_root()
118 const void *objagg_obj_root_priv(const struct objagg_obj *objagg_obj) in objagg_obj_root_priv() argument
120 if (objagg_obj_is_root(objagg_obj)) in objagg_obj_root_priv()
121 return objagg_obj->root_priv; in objagg_obj_root_priv()
122 WARN_ON(!objagg_obj_is_root(objagg_obj->parent)); in objagg_obj_root_priv()
123 return objagg_obj->parent->root_priv; in objagg_obj_root_priv()
136 const void *objagg_obj_delta_priv(const struct objagg_obj *objagg_obj) in objagg_obj_delta_priv() argument
138 if (objagg_obj_is_root(objagg_obj)) in objagg_obj_delta_priv()
140 return objagg_obj->delta_priv; in objagg_obj_delta_priv()
152 const void *objagg_obj_raw(const struct objagg_obj *objagg_obj) in objagg_obj_raw() argument
154 return objagg_obj->obj; in objagg_obj_raw()
158 static struct objagg_obj *objagg_obj_lookup(struct objagg *objagg, void *obj) in objagg_obj_lookup()
164 struct objagg_obj *objagg_obj, in objagg_obj_parent_assign() argument
165 struct objagg_obj *parent, in objagg_obj_parent_assign()
171 objagg_obj->obj); in objagg_obj_parent_assign()
178 objagg_obj->parent = parent; in objagg_obj_parent_assign()
179 objagg_obj->delta_priv = delta_priv; in objagg_obj_parent_assign()
181 objagg_obj_ref_inc(objagg_obj->parent); in objagg_obj_parent_assign()
182 trace_objagg_obj_parent_assign(objagg, objagg_obj, in objagg_obj_parent_assign()
189 struct objagg_obj *objagg_obj) in objagg_obj_parent_lookup_assign() argument
191 struct objagg_obj *objagg_obj_cur; in objagg_obj_parent_lookup_assign()
200 err = objagg_obj_parent_assign(objagg, objagg_obj, in objagg_obj_parent_lookup_assign()
209 struct objagg_obj *objagg_obj);
212 struct objagg_obj *objagg_obj) in objagg_obj_parent_unassign() argument
214 trace_objagg_obj_parent_unassign(objagg, objagg_obj, in objagg_obj_parent_unassign()
215 objagg_obj->parent, in objagg_obj_parent_unassign()
216 objagg_obj->parent->refcount); in objagg_obj_parent_unassign()
217 objagg->ops->delta_destroy(objagg->priv, objagg_obj->delta_priv); in objagg_obj_parent_unassign()
218 __objagg_obj_put(objagg, objagg_obj->parent); in objagg_obj_parent_unassign()
222 struct objagg_obj *objagg_obj, in objagg_obj_root_id_alloc() argument
230 objagg_obj->root_id = OBJAGG_OBJ_ROOT_ID_INVALID; in objagg_obj_root_id_alloc()
249 objagg_obj->root_id = root_id; in objagg_obj_root_id_alloc()
254 struct objagg_obj *objagg_obj) in objagg_obj_root_id_free() argument
258 ida_free(&objagg->root_ida, objagg_obj->root_id); in objagg_obj_root_id_free()
262 struct objagg_obj *objagg_obj, in objagg_obj_root_create() argument
267 err = objagg_obj_root_id_alloc(objagg, objagg_obj, hnode); in objagg_obj_root_create()
270 objagg_obj->root_priv = objagg->ops->root_create(objagg->priv, in objagg_obj_root_create()
271 objagg_obj->obj, in objagg_obj_root_create()
272 objagg_obj->root_id); in objagg_obj_root_create()
273 if (IS_ERR(objagg_obj->root_priv)) { in objagg_obj_root_create()
274 err = PTR_ERR(objagg_obj->root_priv); in objagg_obj_root_create()
277 trace_objagg_obj_root_create(objagg, objagg_obj); in objagg_obj_root_create()
281 objagg_obj_root_id_free(objagg, objagg_obj); in objagg_obj_root_create()
286 struct objagg_obj *objagg_obj) in objagg_obj_root_destroy() argument
288 trace_objagg_obj_root_destroy(objagg, objagg_obj); in objagg_obj_root_destroy()
289 objagg->ops->root_destroy(objagg->priv, objagg_obj->root_priv); in objagg_obj_root_destroy()
290 objagg_obj_root_id_free(objagg, objagg_obj); in objagg_obj_root_destroy()
293 static struct objagg_obj *__objagg_obj_get(struct objagg *objagg, void *obj);
296 struct objagg_obj *objagg_obj, in objagg_obj_init_with_hints() argument
300 struct objagg_obj *parent; in objagg_obj_init_with_hints()
303 hnode = objagg_hints_lookup(objagg->hints, objagg_obj->obj); in objagg_obj_init_with_hints()
311 return objagg_obj_root_create(objagg, objagg_obj, hnode); in objagg_obj_init_with_hints()
317 err = objagg_obj_parent_assign(objagg, objagg_obj, parent, false); in objagg_obj_init_with_hints()
332 struct objagg_obj *objagg_obj) in objagg_obj_init() argument
340 err = objagg_obj_init_with_hints(objagg, objagg_obj, &hint_found); in objagg_obj_init()
348 err = objagg_obj_parent_lookup_assign(objagg, objagg_obj); in objagg_obj_init()
352 return objagg_obj_root_create(objagg, objagg_obj, NULL); in objagg_obj_init()
356 struct objagg_obj *objagg_obj) in objagg_obj_fini() argument
358 if (!objagg_obj_is_root(objagg_obj)) in objagg_obj_fini()
359 objagg_obj_parent_unassign(objagg, objagg_obj); in objagg_obj_fini()
361 objagg_obj_root_destroy(objagg, objagg_obj); in objagg_obj_fini()
364 static struct objagg_obj *objagg_obj_create(struct objagg *objagg, void *obj) in objagg_obj_create()
366 struct objagg_obj *objagg_obj; in objagg_obj_create() local
369 objagg_obj = kzalloc(sizeof(*objagg_obj) + objagg->ops->obj_size, in objagg_obj_create()
371 if (!objagg_obj) in objagg_obj_create()
373 objagg_obj_ref_inc(objagg_obj); in objagg_obj_create()
374 memcpy(objagg_obj->obj, obj, objagg->ops->obj_size); in objagg_obj_create()
376 err = objagg_obj_init(objagg, objagg_obj); in objagg_obj_create()
380 err = rhashtable_insert_fast(&objagg->obj_ht, &objagg_obj->ht_node, in objagg_obj_create()
384 list_add(&objagg_obj->list, &objagg->obj_list); in objagg_obj_create()
386 trace_objagg_obj_create(objagg, objagg_obj); in objagg_obj_create()
388 return objagg_obj; in objagg_obj_create()
391 objagg_obj_fini(objagg, objagg_obj); in objagg_obj_create()
393 kfree(objagg_obj); in objagg_obj_create()
397 static struct objagg_obj *__objagg_obj_get(struct objagg *objagg, void *obj) in __objagg_obj_get()
399 struct objagg_obj *objagg_obj; in __objagg_obj_get() local
404 objagg_obj = objagg_obj_lookup(objagg, obj); in __objagg_obj_get()
405 if (objagg_obj) { in __objagg_obj_get()
406 objagg_obj_ref_inc(objagg_obj); in __objagg_obj_get()
407 return objagg_obj; in __objagg_obj_get()
437 struct objagg_obj *objagg_obj_get(struct objagg *objagg, void *obj) in objagg_obj_get()
439 struct objagg_obj *objagg_obj; in objagg_obj_get() local
441 objagg_obj = __objagg_obj_get(objagg, obj); in objagg_obj_get()
442 if (IS_ERR(objagg_obj)) in objagg_obj_get()
443 return objagg_obj; in objagg_obj_get()
444 objagg_obj_stats_inc(objagg_obj); in objagg_obj_get()
445 trace_objagg_obj_get(objagg, objagg_obj, objagg_obj->refcount); in objagg_obj_get()
446 return objagg_obj; in objagg_obj_get()
451 struct objagg_obj *objagg_obj) in objagg_obj_destroy() argument
453 trace_objagg_obj_destroy(objagg, objagg_obj); in objagg_obj_destroy()
455 list_del(&objagg_obj->list); in objagg_obj_destroy()
456 rhashtable_remove_fast(&objagg->obj_ht, &objagg_obj->ht_node, in objagg_obj_destroy()
458 objagg_obj_fini(objagg, objagg_obj); in objagg_obj_destroy()
459 kfree(objagg_obj); in objagg_obj_destroy()
463 struct objagg_obj *objagg_obj) in __objagg_obj_put() argument
465 if (!objagg_obj_ref_dec(objagg_obj)) in __objagg_obj_put()
466 objagg_obj_destroy(objagg, objagg_obj); in __objagg_obj_put()
478 void objagg_obj_put(struct objagg *objagg, struct objagg_obj *objagg_obj) in objagg_obj_put() argument
480 trace_objagg_obj_put(objagg, objagg_obj, objagg_obj->refcount); in objagg_obj_put()
481 objagg_obj_stats_dec(objagg_obj); in objagg_obj_put()
482 __objagg_obj_put(objagg, objagg_obj); in objagg_obj_put()
537 objagg->ht_params.key_offset = offsetof(struct objagg_obj, obj); in objagg_create()
538 objagg->ht_params.head_offset = offsetof(struct objagg_obj, ht_node); in objagg_create()
607 struct objagg_obj *objagg_obj; in objagg_stats_get() local
616 list_for_each_entry(objagg_obj, &objagg->obj_list, list) { in objagg_stats_get()
617 memcpy(&objagg_stats->stats_info[i].stats, &objagg_obj->stats, in objagg_stats_get()
619 objagg_stats->stats_info[i].objagg_obj = objagg_obj; in objagg_stats_get()
621 objagg_obj_is_root(objagg_obj); in objagg_stats_get()
650 struct objagg_obj *objagg_obj, size_t obj_size, in objagg_hints_node_create() argument
653 unsigned int user_count = objagg_obj->stats.user_count; in objagg_hints_node_create()
660 memcpy(hnode->obj, &objagg_obj->obj, obj_size); in objagg_hints_node_create()
669 hnode->stats_info.objagg_obj = objagg_obj; in objagg_hints_node_create()
700 struct objagg_obj *objagg_obj; member
738 unsigned int weight = node->objagg_obj->stats.user_count; in objagg_tmp_graph_node_weight()
751 weight += node->objagg_obj->stats.user_count; in objagg_tmp_graph_node_weight()
783 struct objagg_obj *objagg_obj; in objagg_tmp_graph_create() local
800 list_for_each_entry(objagg_obj, &objagg->obj_list, list) { in objagg_tmp_graph_create()
802 node->objagg_obj = objagg_obj; in objagg_tmp_graph_create()
815 pnode->objagg_obj->obj, in objagg_tmp_graph_create()
816 node->objagg_obj->obj)) { in objagg_tmp_graph_create()
860 node->objagg_obj, in objagg_opt_simple_greedy_fillup_hints()
876 node->objagg_obj, in objagg_opt_simple_greedy_fillup_hints()