Lines Matching refs:objp

332 static unsigned long long *dbg_redzone1(struct kmem_cache *cachep, void *objp)  in dbg_redzone1()  argument
335 return (unsigned long long*) (objp + obj_offset(cachep) - in dbg_redzone1()
339 static unsigned long long *dbg_redzone2(struct kmem_cache *cachep, void *objp) in dbg_redzone2() argument
343 return (unsigned long long *)(objp + cachep->size - in dbg_redzone2()
346 return (unsigned long long *) (objp + cachep->size - in dbg_redzone2()
350 static void **dbg_userword(struct kmem_cache *cachep, void *objp) in dbg_userword() argument
353 return (void **)(objp + cachep->size - BYTES_PER_WORD); in dbg_userword()
359 #define dbg_redzone1(cachep, objp) ({BUG(); (unsigned long long *)NULL;}) argument
360 #define dbg_redzone2(cachep, objp) ({BUG(); (unsigned long long *)NULL;}) argument
361 #define dbg_userword(cachep, objp) ({BUG(); (void **)NULL;}) argument
552 struct page *page, void *objp) in cache_free_pfmemalloc() argument
562 free_block(cachep, &objp, 1, page_node, &list); in cache_free_pfmemalloc()
592 static __always_inline void __free_one(struct array_cache *ac, void *objp) in __free_one() argument
596 WARN_ON_ONCE(ac->avail > 0 && ac->entry[ac->avail - 1] == objp)) in __free_one()
598 ac->entry[ac->avail++] = objp; in __free_one()
616 static inline int cache_free_alien(struct kmem_cache *cachep, void *objp) in cache_free_alien() argument
762 static int __cache_free_alien(struct kmem_cache *cachep, void *objp, in __cache_free_alien() argument
780 __free_one(ac, objp); in __cache_free_alien()
786 free_block(cachep, &objp, 1, page_node, &list); in __cache_free_alien()
793 static inline int cache_free_alien(struct kmem_cache *cachep, void *objp) in cache_free_alien() argument
795 int page_node = page_to_nid(virt_to_page(objp)); in cache_free_alien()
804 return __cache_free_alien(cachep, objp, node, page_node); in cache_free_alien()
1432 static void slab_kernel_map(struct kmem_cache *cachep, void *objp, int map) in slab_kernel_map() argument
1437 kernel_map_pages(virt_to_page(objp), cachep->size / PAGE_SIZE, map); in slab_kernel_map()
1441 static inline void slab_kernel_map(struct kmem_cache *cachep, void *objp, in slab_kernel_map() argument
1487 static void print_objinfo(struct kmem_cache *cachep, void *objp, int lines) in print_objinfo() argument
1494 *dbg_redzone1(cachep, objp), in print_objinfo()
1495 *dbg_redzone2(cachep, objp)); in print_objinfo()
1499 pr_err("Last user: (%pSR)\n", *dbg_userword(cachep, objp)); in print_objinfo()
1500 realobj = (char *)objp + obj_offset(cachep); in print_objinfo()
1511 static void check_poison_obj(struct kmem_cache *cachep, void *objp) in check_poison_obj() argument
1520 realobj = (char *)objp + obj_offset(cachep); in check_poison_obj()
1535 print_objinfo(cachep, objp, 0); in check_poison_obj()
1554 struct page *page = virt_to_head_page(objp); in check_poison_obj()
1557 objnr = obj_to_index(cachep, page, objp); in check_poison_obj()
1559 objp = index_to_obj(cachep, page, objnr - 1); in check_poison_obj()
1560 realobj = (char *)objp + obj_offset(cachep); in check_poison_obj()
1562 print_objinfo(cachep, objp, 2); in check_poison_obj()
1565 objp = index_to_obj(cachep, page, objnr + 1); in check_poison_obj()
1566 realobj = (char *)objp + obj_offset(cachep); in check_poison_obj()
1568 print_objinfo(cachep, objp, 2); in check_poison_obj()
1586 void *objp = index_to_obj(cachep, page, i); in slab_destroy_debugcheck() local
1589 check_poison_obj(cachep, objp); in slab_destroy_debugcheck()
1590 slab_kernel_map(cachep, objp, 1); in slab_destroy_debugcheck()
1593 if (*dbg_redzone1(cachep, objp) != RED_INACTIVE) in slab_destroy_debugcheck()
1595 if (*dbg_redzone2(cachep, objp) != RED_INACTIVE) in slab_destroy_debugcheck()
2334 void *objp = index_to_obj(cachep, page, i); in cache_init_objs_debug() local
2337 *dbg_userword(cachep, objp) = NULL; in cache_init_objs_debug()
2340 *dbg_redzone1(cachep, objp) = RED_INACTIVE; in cache_init_objs_debug()
2341 *dbg_redzone2(cachep, objp) = RED_INACTIVE; in cache_init_objs_debug()
2350 objp + obj_offset(cachep)); in cache_init_objs_debug()
2351 cachep->ctor(objp + obj_offset(cachep)); in cache_init_objs_debug()
2353 cachep, objp + obj_offset(cachep)); in cache_init_objs_debug()
2357 if (*dbg_redzone2(cachep, objp) != RED_INACTIVE) in cache_init_objs_debug()
2359 if (*dbg_redzone1(cachep, objp) != RED_INACTIVE) in cache_init_objs_debug()
2364 poison_obj(cachep, objp, POISON_FREE); in cache_init_objs_debug()
2365 slab_kernel_map(cachep, objp, 0); in cache_init_objs_debug()
2486 void *objp; in cache_init_objs() local
2500 objp = index_to_obj(cachep, page, i); in cache_init_objs()
2501 objp = kasan_init_slab_obj(cachep, objp); in cache_init_objs()
2505 kasan_unpoison_object_data(cachep, objp); in cache_init_objs()
2506 cachep->ctor(objp); in cache_init_objs()
2507 kasan_poison_object_data(cachep, objp); in cache_init_objs()
2517 void *objp; in slab_get_obj() local
2519 objp = index_to_obj(cachep, page, get_free_obj(page, page->active)); in slab_get_obj()
2522 return objp; in slab_get_obj()
2526 struct page *page, void *objp) in slab_put_obj() argument
2528 unsigned int objnr = obj_to_index(cachep, page, objp); in slab_put_obj()
2536 cachep->name, objp); in slab_put_obj()
2543 page->freelist = objp + obj_offset(cachep); in slab_put_obj()
2675 static void kfree_debugcheck(const void *objp) in kfree_debugcheck() argument
2677 if (!virt_addr_valid(objp)) { in kfree_debugcheck()
2679 (unsigned long)objp); in kfree_debugcheck()
2706 static void *cache_free_debugcheck(struct kmem_cache *cachep, void *objp, in cache_free_debugcheck() argument
2712 BUG_ON(virt_to_cache(objp) != cachep); in cache_free_debugcheck()
2714 objp -= obj_offset(cachep); in cache_free_debugcheck()
2715 kfree_debugcheck(objp); in cache_free_debugcheck()
2716 page = virt_to_head_page(objp); in cache_free_debugcheck()
2719 verify_redzone_free(cachep, objp); in cache_free_debugcheck()
2720 *dbg_redzone1(cachep, objp) = RED_INACTIVE; in cache_free_debugcheck()
2721 *dbg_redzone2(cachep, objp) = RED_INACTIVE; in cache_free_debugcheck()
2724 *dbg_userword(cachep, objp) = (void *)caller; in cache_free_debugcheck()
2726 objnr = obj_to_index(cachep, page, objp); in cache_free_debugcheck()
2729 BUG_ON(objp != index_to_obj(cachep, page, objnr)); in cache_free_debugcheck()
2732 poison_obj(cachep, objp, POISON_FREE); in cache_free_debugcheck()
2733 slab_kernel_map(cachep, objp, 0); in cache_free_debugcheck()
2735 return objp; in cache_free_debugcheck()
2740 #define cache_free_debugcheck(x,objp,z) (objp) argument
2748 void *objp; in fixup_objfreelist_debug() local
2751 objp = next - obj_offset(cachep); in fixup_objfreelist_debug()
2753 poison_obj(cachep, objp, POISON_FREE); in fixup_objfreelist_debug()
2770 void **objp = page->freelist; in fixup_slab_list() local
2772 *objp = *list; in fixup_slab_list()
2773 *list = objp; in fixup_slab_list()
2991 gfp_t flags, void *objp, unsigned long caller) in cache_alloc_debugcheck_after() argument
2994 if (!objp) in cache_alloc_debugcheck_after()
2995 return objp; in cache_alloc_debugcheck_after()
2997 check_poison_obj(cachep, objp); in cache_alloc_debugcheck_after()
2998 slab_kernel_map(cachep, objp, 1); in cache_alloc_debugcheck_after()
2999 poison_obj(cachep, objp, POISON_INUSE); in cache_alloc_debugcheck_after()
3002 *dbg_userword(cachep, objp) = (void *)caller; in cache_alloc_debugcheck_after()
3005 if (*dbg_redzone1(cachep, objp) != RED_INACTIVE || in cache_alloc_debugcheck_after()
3006 *dbg_redzone2(cachep, objp) != RED_INACTIVE) { in cache_alloc_debugcheck_after()
3009 objp, *dbg_redzone1(cachep, objp), in cache_alloc_debugcheck_after()
3010 *dbg_redzone2(cachep, objp)); in cache_alloc_debugcheck_after()
3012 *dbg_redzone1(cachep, objp) = RED_ACTIVE; in cache_alloc_debugcheck_after()
3013 *dbg_redzone2(cachep, objp) = RED_ACTIVE; in cache_alloc_debugcheck_after()
3016 objp += obj_offset(cachep); in cache_alloc_debugcheck_after()
3018 cachep->ctor(objp); in cache_alloc_debugcheck_after()
3020 ((unsigned long)objp & (ARCH_SLAB_MINALIGN-1))) { in cache_alloc_debugcheck_after()
3022 objp, (int)ARCH_SLAB_MINALIGN); in cache_alloc_debugcheck_after()
3024 return objp; in cache_alloc_debugcheck_after()
3027 #define cache_alloc_debugcheck_after(a,b,objp,d) (objp) argument
3032 void *objp; in ____cache_alloc() local
3040 objp = ac->entry[--ac->avail]; in ____cache_alloc()
3047 objp = cache_alloc_refill(cachep, flags); in ____cache_alloc()
3060 if (objp) in ____cache_alloc()
3062 return objp; in ____cache_alloc()
3263 void *objp; in __do_cache_alloc() local
3266 objp = alternate_node_alloc(cache, flags); in __do_cache_alloc()
3267 if (objp) in __do_cache_alloc()
3270 objp = ____cache_alloc(cache, flags); in __do_cache_alloc()
3276 if (!objp) in __do_cache_alloc()
3277 objp = ____cache_alloc_node(cache, flags, numa_mem_id()); in __do_cache_alloc()
3280 return objp; in __do_cache_alloc()
3296 void *objp; in slab_alloc() local
3306 objp = __do_cache_alloc(cachep, flags); in slab_alloc()
3308 objp = cache_alloc_debugcheck_after(cachep, flags, objp, caller); in slab_alloc()
3309 prefetchw(objp); in slab_alloc()
3311 if (unlikely(slab_want_init_on_alloc(flags, cachep)) && objp) in slab_alloc()
3312 memset(objp, 0, cachep->object_size); in slab_alloc()
3314 slab_post_alloc_hook(cachep, objcg, flags, 1, &objp); in slab_alloc()
3315 return objp; in slab_alloc()
3332 void *objp; in free_block() local
3335 objp = objpp[i]; in free_block()
3337 page = virt_to_head_page(objp); in free_block()
3340 slab_put_obj(cachep, page, objp); in free_block()
3416 static __always_inline void __cache_free(struct kmem_cache *cachep, void *objp, in __cache_free() argument
3420 if (kasan_slab_free(cachep, objp, _RET_IP_)) in __cache_free()
3425 __kcsan_check_access(objp, cachep->object_size, in __cache_free()
3428 ___cache_free(cachep, objp, caller); in __cache_free()
3431 void ___cache_free(struct kmem_cache *cachep, void *objp, in ___cache_free() argument
3438 memset(objp, 0, cachep->object_size); in ___cache_free()
3439 kmemleak_free_recursive(objp, cachep->flags); in ___cache_free()
3440 objp = cache_free_debugcheck(cachep, objp, caller); in ___cache_free()
3441 memcg_slab_free_hook(cachep, &objp, 1); in ___cache_free()
3450 if (nr_online_nodes > 1 && cache_free_alien(cachep, objp)) in ___cache_free()
3461 struct page *page = virt_to_head_page(objp); in ___cache_free()
3464 cache_free_pfmemalloc(cachep, page, objp); in ___cache_free()
3469 __free_one(ac, objp); in ___cache_free()
3517 void *objp = __do_cache_alloc(s, flags); in kmem_cache_alloc_bulk() local
3519 if (unlikely(!objp)) in kmem_cache_alloc_bulk()
3521 p[i] = objp; in kmem_cache_alloc_bulk()
3684 void kmem_cache_free(struct kmem_cache *cachep, void *objp) in kmem_cache_free() argument
3687 cachep = cache_from_obj(cachep, objp); in kmem_cache_free()
3692 debug_check_no_locks_freed(objp, cachep->object_size); in kmem_cache_free()
3694 debug_check_no_obj_freed(objp, cachep->object_size); in kmem_cache_free()
3695 __cache_free(cachep, objp, _RET_IP_); in kmem_cache_free()
3698 trace_kmem_cache_free(_RET_IP_, objp); in kmem_cache_free()
3709 void *objp = p[i]; in kmem_cache_free_bulk() local
3712 s = virt_to_cache(objp); in kmem_cache_free_bulk()
3714 s = cache_from_obj(orig_s, objp); in kmem_cache_free_bulk()
3718 debug_check_no_locks_freed(objp, s->object_size); in kmem_cache_free_bulk()
3720 debug_check_no_obj_freed(objp, s->object_size); in kmem_cache_free_bulk()
3722 __cache_free(s, objp, _RET_IP_); in kmem_cache_free_bulk()
3739 void kfree(const void *objp) in kfree() argument
3744 trace_kfree(_RET_IP_, objp); in kfree()
3746 if (unlikely(ZERO_OR_NULL_PTR(objp))) in kfree()
3749 kfree_debugcheck(objp); in kfree()
3750 c = virt_to_cache(objp); in kfree()
3755 debug_check_no_locks_freed(objp, c->object_size); in kfree()
3757 debug_check_no_obj_freed(objp, c->object_size); in kfree()
3758 __cache_free(c, (void *)objp, _RET_IP_); in kfree()
4188 size_t __ksize(const void *objp) in __ksize() argument
4193 BUG_ON(!objp); in __ksize()
4194 if (unlikely(objp == ZERO_SIZE_PTR)) in __ksize()
4197 c = virt_to_cache(objp); in __ksize()