Lines Matching refs:stack

361 	struct stack_record *stack;  in depot_pop_free_pool()  local
379 stack = current_pool + pool_offset; in depot_pop_free_pool()
382 stack->handle.pool_index_plus_1 = pool_index + 1; in depot_pop_free_pool()
383 stack->handle.offset = pool_offset >> DEPOT_STACK_ALIGN; in depot_pop_free_pool()
384 stack->handle.extra = 0; in depot_pop_free_pool()
385 INIT_LIST_HEAD(&stack->hash_list); in depot_pop_free_pool()
389 return stack; in depot_pop_free_pool()
395 struct stack_record *stack; in depot_pop_free() local
408 stack = list_first_entry(&free_stacks, struct stack_record, free_list); in depot_pop_free()
409 if (!poll_state_synchronize_rcu(stack->rcu_state)) in depot_pop_free()
412 list_del(&stack->free_list); in depot_pop_free()
415 return stack; in depot_pop_free()
432 struct stack_record *stack = NULL; in depot_alloc_stack() local
450 record_size = depot_stack_record_size(stack, CONFIG_STACKDEPOT_MAX_FRAMES); in depot_alloc_stack()
451 stack = depot_pop_free(); in depot_alloc_stack()
453 record_size = depot_stack_record_size(stack, nr_entries); in depot_alloc_stack()
456 if (!stack) { in depot_alloc_stack()
457 stack = depot_pop_free_pool(prealloc, record_size); in depot_alloc_stack()
458 if (!stack) in depot_alloc_stack()
463 stack->hash = hash; in depot_alloc_stack()
464 stack->size = nr_entries; in depot_alloc_stack()
466 memcpy(stack->entries, entries, flex_array_size(stack, entries, nr_entries)); in depot_alloc_stack()
469 refcount_set(&stack->count, 1); in depot_alloc_stack()
474 refcount_set(&stack->count, REFCOUNT_SATURATED); in depot_alloc_stack()
483 kmsan_unpoison_memory(stack, record_size); in depot_alloc_stack()
485 return stack; in depot_alloc_stack()
495 struct stack_record *stack; in depot_fetch_stack() local
509 stack = pool + offset; in depot_fetch_stack()
510 if (WARN_ON(!refcount_read(&stack->count))) in depot_fetch_stack()
513 return stack; in depot_fetch_stack()
517 static void depot_free_stack(struct stack_record *stack) in depot_free_stack() argument
531 list_del_rcu(&stack->hash_list); in depot_free_stack()
543 stack->rcu_state = get_state_synchronize_rcu(); in depot_free_stack()
550 list_add_tail(&stack->free_list, &free_stacks); in depot_free_stack()
588 struct stack_record *stack, *ret = NULL; in find_stack() local
601 list_for_each_entry_rcu(stack, bucket, hash_list) { in find_stack()
602 if (stack->hash != hash || stack->size != size) in find_stack()
610 if (data_race(stackdepot_memcmp(entries, stack->entries, size))) in find_stack()
621 if ((flags & STACK_DEPOT_FLAG_GET) && !refcount_inc_not_zero(&stack->count)) in find_stack()
624 ret = stack; in find_stack()
755 struct stack_record *stack; in stack_depot_fetch() local
767 stack = depot_fetch_stack(handle); in stack_depot_fetch()
772 if (WARN(!stack, "corrupt handle or use after stack_depot_put()")) in stack_depot_fetch()
775 *entries = stack->entries; in stack_depot_fetch()
776 return stack->size; in stack_depot_fetch()
782 struct stack_record *stack; in stack_depot_put() local
787 stack = depot_fetch_stack(handle); in stack_depot_put()
792 if (WARN(!stack, "corrupt handle or unbalanced stack_depot_put()")) in stack_depot_put()
795 if (refcount_dec_and_test(&stack->count)) in stack_depot_put()
796 depot_free_stack(stack); in stack_depot_put()
800 void stack_depot_print(depot_stack_handle_t stack) in stack_depot_print() argument
805 nr_entries = stack_depot_fetch(stack, &entries); in stack_depot_print()