Re: [PATCH] ref_tracker: add stack_depot_save() failure handling to ref_tracker_alloc()

From: Tetsuo Handa
Date: Tue May 30 2023 - 05:54:04 EST

On 2023/05/30 16:22, Eric Dumazet wrote:
>>> Therefore, assume that stack_depot_save(GFP_KERNEL | __GFP_NOFAIL) from
>>> ref_tracker_alloc() can silently fail, and emit "unreliable refcount
>>> tracker." message.
> Note: I never assumed stack_depot_save() would enforce/use NOFAIL.

Hmm, I misread this function.

gfp_mask |= __GFP_NOFAIL; // Or'ing to "gfp_mask" than "gfp".
*trackerp = tracker = kzalloc(sizeof(*tracker), gfp_mask); // <= This is "gfp_mask".
tracker->alloc_stack_handle = stack_depot_save(entries, nr_entries, gfp); // <= This is "gfp".

So, stack_depot_save(GFP_KERNEL | __GFP_NOFAIL) is not happening.

Then, question becomes whether we want tracker->alloc_stack_handle != NULL or not.
If tracker->alloc_stack_handle == NULL is still useful, this patch will be useless...