Re: [PATCH v4] vmstat: Kernel stack usage histogram

From: Andrew Morton
Date: Tue Jul 23 2024 - 20:10:07 EST


On Thu, 18 Jul 2024 22:55:17 -0400 Pasha Tatashin <pasha.tatashin@xxxxxxxxxx> wrote:

> >
> > > +{
> > > + if (used_stack <= 1024)
> > > + this_cpu_inc(vm_event_states.event[KSTACK_1K]);
> >
> > Why not count_vm_event(KSTACK_1K)? Avoiding header include recursion?
>
> I could not include "linux/vmstat.h" into "linux/sched/task_stack.h"
> because it introduces some dependencies such linux/mm.h and
> linux/fs.h, uapi/linux/stat.h, and when all of those are added it
> still fails to compile on some architectures, so it was just simpler
> to stop resolving the conflicts and use this_cpu_inc() directly.

Presumably uninlining stack_not_used() will permit this
to be cleaned up.