Lines Matching refs:obj
132 struct debug_obj *obj; in fill_pool() local
149 obj = hlist_entry(obj_to_free.first, typeof(*obj), node); in fill_pool()
150 hlist_del(&obj->node); in fill_pool()
152 hlist_add_head(&obj->node, &obj_pool); in fill_pool()
188 struct debug_obj *obj; in lookup_object() local
191 hlist_for_each_entry(obj, &b->list, node) { in lookup_object()
193 if (obj->object == addr) in lookup_object()
194 return obj; in lookup_object()
207 struct debug_obj *obj = NULL; in __alloc_object() local
210 obj = hlist_entry(list->first, typeof(*obj), node); in __alloc_object()
211 hlist_del(&obj->node); in __alloc_object()
214 return obj; in __alloc_object()
225 struct debug_obj *obj; in alloc_object() local
228 obj = __alloc_object(&percpu_pool->free_objs); in alloc_object()
229 if (obj) { in alloc_object()
236 obj = __alloc_object(&obj_pool); in alloc_object()
237 if (obj) { in alloc_object()
271 if (obj) { in alloc_object()
272 obj->object = addr; in alloc_object()
273 obj->descr = descr; in alloc_object()
274 obj->state = ODEBUG_STATE_NONE; in alloc_object()
275 obj->astate = 0; in alloc_object()
276 hlist_add_head(&obj->node, &b->list); in alloc_object()
278 return obj; in alloc_object()
290 struct debug_obj *obj; in free_obj_work() local
309 obj = hlist_entry(obj_to_free.first, typeof(*obj), node); in free_obj_work()
310 hlist_del(&obj->node); in free_obj_work()
311 hlist_add_head(&obj->node, &obj_pool); in free_obj_work()
331 hlist_for_each_entry_safe(obj, tmp, &tofree, node) { in free_obj_work()
332 hlist_del(&obj->node); in free_obj_work()
333 kmem_cache_free(obj_cache, obj); in free_obj_work()
337 static void __free_object(struct debug_obj *obj) in __free_object() argument
354 hlist_add_head(&obj->node, &percpu_pool->free_objs); in __free_object()
379 hlist_add_head(&obj->node, &obj_to_free); in __free_object()
397 obj = __alloc_object(&obj_pool); in __free_object()
398 hlist_add_head(&obj->node, &obj_to_free); in __free_object()
405 hlist_add_head(&obj->node, &obj_pool); in __free_object()
423 static void free_object(struct debug_obj *obj) in free_object() argument
425 __free_object(obj); in free_object()
441 struct debug_obj *obj; in debug_objects_oom() local
453 hlist_for_each_entry_safe(obj, tmp, &freelist, node) { in debug_objects_oom()
454 hlist_del(&obj->node); in debug_objects_oom()
455 free_object(obj); in debug_objects_oom()
472 static void debug_print_object(struct debug_obj *obj, char *msg) in debug_print_object() argument
474 struct debug_obj_descr *descr = obj->descr; in debug_print_object()
479 descr->debug_hint(obj->object) : NULL; in debug_print_object()
483 msg, obj_states[obj->state], obj->astate, in debug_print_object()
533 struct debug_obj *obj; in __debug_object_init() local
542 obj = lookup_object(addr, db); in __debug_object_init()
543 if (!obj) { in __debug_object_init()
544 obj = alloc_object(addr, db, descr); in __debug_object_init()
545 if (!obj) { in __debug_object_init()
554 switch (obj->state) { in __debug_object_init()
558 obj->state = ODEBUG_STATE_INIT; in __debug_object_init()
562 state = obj->state; in __debug_object_init()
564 debug_print_object(obj, "init"); in __debug_object_init()
570 debug_print_object(obj, "init"); in __debug_object_init()
620 struct debug_obj *obj; in debug_object_activate() local
634 obj = lookup_object(addr, db); in debug_object_activate()
635 if (obj) { in debug_object_activate()
638 switch (obj->state) { in debug_object_activate()
641 obj->state = ODEBUG_STATE_ACTIVE; in debug_object_activate()
646 state = obj->state; in debug_object_activate()
648 debug_print_object(obj, "activate"); in debug_object_activate()
662 debug_print_object(obj, "activate"); in debug_object_activate()
697 struct debug_obj *obj; in debug_object_deactivate() local
708 obj = lookup_object(addr, db); in debug_object_deactivate()
709 if (obj) { in debug_object_deactivate()
710 switch (obj->state) { in debug_object_deactivate()
714 if (!obj->astate) in debug_object_deactivate()
715 obj->state = ODEBUG_STATE_INACTIVE; in debug_object_deactivate()
729 if (!obj) { in debug_object_deactivate()
736 debug_print_object(obj, "deactivate"); in debug_object_deactivate()
750 struct debug_obj *obj; in debug_object_destroy() local
761 obj = lookup_object(addr, db); in debug_object_destroy()
762 if (!obj) in debug_object_destroy()
765 switch (obj->state) { in debug_object_destroy()
769 obj->state = ODEBUG_STATE_DESTROYED; in debug_object_destroy()
772 state = obj->state; in debug_object_destroy()
774 debug_print_object(obj, "destroy"); in debug_object_destroy()
787 debug_print_object(obj, "destroy"); in debug_object_destroy()
800 struct debug_obj *obj; in debug_object_free() local
810 obj = lookup_object(addr, db); in debug_object_free()
811 if (!obj) in debug_object_free()
814 switch (obj->state) { in debug_object_free()
816 state = obj->state; in debug_object_free()
818 debug_print_object(obj, "free"); in debug_object_free()
822 hlist_del(&obj->node); in debug_object_free()
824 free_object(obj); in debug_object_free()
840 struct debug_obj *obj; in debug_object_assert_init() local
850 obj = lookup_object(addr, db); in debug_object_assert_init()
851 if (!obj) { in debug_object_assert_init()
889 struct debug_obj *obj; in debug_object_active_state() local
900 obj = lookup_object(addr, db); in debug_object_active_state()
901 if (obj) { in debug_object_active_state()
902 switch (obj->state) { in debug_object_active_state()
904 if (obj->astate == expect) in debug_object_active_state()
905 obj->astate = next; in debug_object_active_state()
917 if (!obj) { in debug_object_active_state()
924 debug_print_object(obj, "active_state"); in debug_object_active_state()
937 struct debug_obj *obj; in __debug_check_no_obj_freed() local
952 hlist_for_each_entry_safe(obj, tmp, &db->list, node) { in __debug_check_no_obj_freed()
954 oaddr = (unsigned long) obj->object; in __debug_check_no_obj_freed()
958 switch (obj->state) { in __debug_check_no_obj_freed()
960 descr = obj->descr; in __debug_check_no_obj_freed()
961 state = obj->state; in __debug_check_no_obj_freed()
963 debug_print_object(obj, "free"); in __debug_check_no_obj_freed()
968 hlist_del(&obj->node); in __debug_check_no_obj_freed()
969 __free_object(obj); in __debug_check_no_obj_freed()
1066 struct self_test *obj = addr; in is_static_object() local
1068 return obj->static_init; in is_static_object()
1077 struct self_test *obj = addr; in fixup_init() local
1081 debug_object_deactivate(obj, &descr_type_test); in fixup_init()
1082 debug_object_init(obj, &descr_type_test); in fixup_init()
1096 struct self_test *obj = addr; in fixup_activate() local
1102 debug_object_deactivate(obj, &descr_type_test); in fixup_activate()
1103 debug_object_activate(obj, &descr_type_test); in fixup_activate()
1117 struct self_test *obj = addr; in fixup_destroy() local
1121 debug_object_deactivate(obj, &descr_type_test); in fixup_destroy()
1122 debug_object_destroy(obj, &descr_type_test); in fixup_destroy()
1135 struct self_test *obj = addr; in fixup_free() local
1139 debug_object_deactivate(obj, &descr_type_test); in fixup_free()
1140 debug_object_free(obj, &descr_type_test); in fixup_free()
1151 struct debug_obj *obj; in check_results() local
1159 obj = lookup_object(addr, db); in check_results()
1160 if (!obj && state != ODEBUG_STATE_NONE) { in check_results()
1164 if (obj && obj->state != state) { in check_results()
1166 obj->state, state); in check_results()
1196 static __initdata struct self_test obj = { .static_init = 0 }; variable
1209 debug_object_init(&obj, &descr_type_test); in debug_objects_selftest()
1210 if (check_results(&obj, ODEBUG_STATE_INIT, fixups, warnings)) in debug_objects_selftest()
1212 debug_object_activate(&obj, &descr_type_test); in debug_objects_selftest()
1213 if (check_results(&obj, ODEBUG_STATE_ACTIVE, fixups, warnings)) in debug_objects_selftest()
1215 debug_object_activate(&obj, &descr_type_test); in debug_objects_selftest()
1216 if (check_results(&obj, ODEBUG_STATE_ACTIVE, ++fixups, ++warnings)) in debug_objects_selftest()
1218 debug_object_deactivate(&obj, &descr_type_test); in debug_objects_selftest()
1219 if (check_results(&obj, ODEBUG_STATE_INACTIVE, fixups, warnings)) in debug_objects_selftest()
1221 debug_object_destroy(&obj, &descr_type_test); in debug_objects_selftest()
1222 if (check_results(&obj, ODEBUG_STATE_DESTROYED, fixups, warnings)) in debug_objects_selftest()
1224 debug_object_init(&obj, &descr_type_test); in debug_objects_selftest()
1225 if (check_results(&obj, ODEBUG_STATE_DESTROYED, fixups, ++warnings)) in debug_objects_selftest()
1227 debug_object_activate(&obj, &descr_type_test); in debug_objects_selftest()
1228 if (check_results(&obj, ODEBUG_STATE_DESTROYED, fixups, ++warnings)) in debug_objects_selftest()
1230 debug_object_deactivate(&obj, &descr_type_test); in debug_objects_selftest()
1231 if (check_results(&obj, ODEBUG_STATE_DESTROYED, fixups, ++warnings)) in debug_objects_selftest()
1233 debug_object_free(&obj, &descr_type_test); in debug_objects_selftest()
1234 if (check_results(&obj, ODEBUG_STATE_NONE, fixups, warnings)) in debug_objects_selftest()
1237 obj.static_init = 1; in debug_objects_selftest()
1238 debug_object_activate(&obj, &descr_type_test); in debug_objects_selftest()
1239 if (check_results(&obj, ODEBUG_STATE_ACTIVE, fixups, warnings)) in debug_objects_selftest()
1241 debug_object_init(&obj, &descr_type_test); in debug_objects_selftest()
1242 if (check_results(&obj, ODEBUG_STATE_INIT, ++fixups, ++warnings)) in debug_objects_selftest()
1244 debug_object_free(&obj, &descr_type_test); in debug_objects_selftest()
1245 if (check_results(&obj, ODEBUG_STATE_NONE, fixups, warnings)) in debug_objects_selftest()
1249 debug_object_init(&obj, &descr_type_test); in debug_objects_selftest()
1250 if (check_results(&obj, ODEBUG_STATE_INIT, fixups, warnings)) in debug_objects_selftest()
1252 debug_object_activate(&obj, &descr_type_test); in debug_objects_selftest()
1253 if (check_results(&obj, ODEBUG_STATE_ACTIVE, fixups, warnings)) in debug_objects_selftest()
1255 __debug_check_no_obj_freed(&obj, sizeof(obj)); in debug_objects_selftest()
1256 if (check_results(&obj, ODEBUG_STATE_NONE, ++fixups, ++warnings)) in debug_objects_selftest()
1295 struct debug_obj *obj, *new; in debug_objects_replace_static_objects() local
1300 obj = kmem_cache_zalloc(obj_cache, GFP_KERNEL); in debug_objects_replace_static_objects()
1301 if (!obj) in debug_objects_replace_static_objects()
1303 hlist_add_head(&obj->node, &objects); in debug_objects_replace_static_objects()
1313 hlist_for_each_entry_safe(obj, tmp, &obj_pool, node) in debug_objects_replace_static_objects()
1314 hlist_del(&obj->node); in debug_objects_replace_static_objects()
1322 hlist_for_each_entry(obj, &objects, node) { in debug_objects_replace_static_objects()
1323 new = hlist_entry(obj_pool.first, typeof(*obj), node); in debug_objects_replace_static_objects()
1326 *new = *obj; in debug_objects_replace_static_objects()
1336 hlist_for_each_entry_safe(obj, tmp, &objects, node) { in debug_objects_replace_static_objects()
1337 hlist_del(&obj->node); in debug_objects_replace_static_objects()
1338 kmem_cache_free(obj_cache, obj); in debug_objects_replace_static_objects()