Lines Matching refs:stack

312 	struct stack_record *stack;  in depot_pop_free_pool()  local
330 stack = current_pool + pool_offset; in depot_pop_free_pool()
333 stack->handle.pool_index_plus_1 = pool_index + 1; in depot_pop_free_pool()
334 stack->handle.offset = pool_offset >> DEPOT_STACK_ALIGN; in depot_pop_free_pool()
335 stack->handle.extra = 0; in depot_pop_free_pool()
336 INIT_LIST_HEAD(&stack->hash_list); in depot_pop_free_pool()
340 return stack; in depot_pop_free_pool()
346 struct stack_record *stack; in depot_pop_free() local
359 stack = list_first_entry(&free_stacks, struct stack_record, free_list); in depot_pop_free()
360 if (!poll_state_synchronize_rcu(stack->rcu_state)) in depot_pop_free()
363 list_del(&stack->free_list); in depot_pop_free()
366 return stack; in depot_pop_free()
383 struct stack_record *stack = NULL; in depot_alloc_stack() local
401 record_size = depot_stack_record_size(stack, CONFIG_STACKDEPOT_MAX_FRAMES); in depot_alloc_stack()
402 stack = depot_pop_free(); in depot_alloc_stack()
404 record_size = depot_stack_record_size(stack, nr_entries); in depot_alloc_stack()
407 if (!stack) { in depot_alloc_stack()
408 stack = depot_pop_free_pool(prealloc, record_size); in depot_alloc_stack()
409 if (!stack) in depot_alloc_stack()
414 stack->hash = hash; in depot_alloc_stack()
415 stack->size = nr_entries; in depot_alloc_stack()
417 memcpy(stack->entries, entries, flex_array_size(stack, entries, nr_entries)); in depot_alloc_stack()
420 refcount_set(&stack->count, 1); in depot_alloc_stack()
425 refcount_set(&stack->count, REFCOUNT_SATURATED); in depot_alloc_stack()
434 kmsan_unpoison_memory(stack, record_size); in depot_alloc_stack()
436 return stack; in depot_alloc_stack()
446 struct stack_record *stack; in depot_fetch_stack() local
460 stack = pool + offset; in depot_fetch_stack()
461 if (WARN_ON(!refcount_read(&stack->count))) in depot_fetch_stack()
464 return stack; in depot_fetch_stack()
468 static void depot_free_stack(struct stack_record *stack) in depot_free_stack() argument
482 list_del_rcu(&stack->hash_list); in depot_free_stack()
494 stack->rcu_state = get_state_synchronize_rcu(); in depot_free_stack()
501 list_add_tail(&stack->free_list, &free_stacks); in depot_free_stack()
539 struct stack_record *stack, *ret = NULL; in find_stack() local
552 list_for_each_entry_rcu(stack, bucket, hash_list) { in find_stack()
553 if (stack->hash != hash || stack->size != size) in find_stack()
561 if (data_race(stackdepot_memcmp(entries, stack->entries, size))) in find_stack()
572 if ((flags & STACK_DEPOT_FLAG_GET) && !refcount_inc_not_zero(&stack->count)) in find_stack()
575 ret = stack; in find_stack()
694 struct stack_record *stack; in stack_depot_fetch() local
706 stack = depot_fetch_stack(handle); in stack_depot_fetch()
711 if (WARN(!stack, "corrupt handle or use after stack_depot_put()")) in stack_depot_fetch()
714 *entries = stack->entries; in stack_depot_fetch()
715 return stack->size; in stack_depot_fetch()
721 struct stack_record *stack; in stack_depot_put() local
726 stack = depot_fetch_stack(handle); in stack_depot_put()
731 if (WARN(!stack, "corrupt handle or unbalanced stack_depot_put()")) in stack_depot_put()
734 if (refcount_dec_and_test(&stack->count)) in stack_depot_put()
735 depot_free_stack(stack); in stack_depot_put()
739 void stack_depot_print(depot_stack_handle_t stack) in stack_depot_print() argument
744 nr_entries = stack_depot_fetch(stack, &entries); in stack_depot_print()