On 2024/03/20 8:24, Andrew Morton wrote: > On Tue, 19 Mar 2024 19:32:11 +0100 Oscar Salvador <osalvador@xxxxxxx> wrote: >> -static void dec_stack_record_count(depot_stack_handle_t handle) >> +static void dec_stack_record_count(depot_stack_handle_t handle, >> + int nr_base_pages) >> { >> struct stack_record *stack_record = __stack_depot_get_stack_record(handle); >> >> if (stack_record) >> - refcount_dec(&stack_record->count); >> + refcount_sub_and_test(nr_base_pages, &stack_record->count); >> } > > mm/page_owner.c: In function 'dec_stack_record_count': > mm/page_owner.c:226:17: error: ignoring return value of 'refcount_sub_and_test' declared with attribute 'warn_unused_result' [-Werror=unused-result] > 226 | refcount_sub_and_test(nr_base_pages, &stack_record->count); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > cc1: all warnings being treated as errors > Hmm, I guess that this is not an expected user of refcount API. If it is correct behavior that refcount becomes 0 here, you need to explain like - refcount_sub_and_test(nr_base_pages, &stack_record->count); + if (refcount_sub_and_test(nr_base_pages, &stack_record->count)) { + // Explain why nothing to do here, and explain where/how + // refcount again becomes positive value using refcount_set(). + } or replace refcount_t with atomic_t where it is legal to make refcount positive without using atomic_set().