On 5/22/23 10:40, Alexander Potapenko wrote: > 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. Agreed, that should be a much cleaner approach.