Re: [PATCH v5 3/3] mm,page_owner: Filter out stacks by a threshold counter

From: Alexander Potapenko
Date: Mon May 22 2023 - 04:41:39 EST


On Tue, May 16, 2023 at 8:25 PM Oscar Salvador <osalvador@xxxxxxx> wrote:
>
> We want to be able to filter out the output on a threshold basis,
> in this way we can get rid of a lot of noise and focus only on those
> stacks which have an allegedly high counter.
>
> We can control the threshold value by a new file called
> 'page_owner_threshold', which is 0 by default.
>
> Signed-off-by: Oscar Salvador <osalvador@xxxxxxx>

Nack.
We must decouple stackdepot from page_owner as much as possible, not
add extra dependencies by sharing variables between the two.

What you need here is a pair of xxx_iter_start()/xxx_iter_next()
functions in stackdepot.c that will hold the iteration state in a
struct and return the next stack trace.
The threshold value can also be part of that struct.