Re: [PATCH] vmstat: Keep count of the maximum page reached by the kernel stack

From: Christophe Leroy
Date: Thu Mar 14 2024 - 04:19:33 EST




Le 13/03/2024 à 04:34, Pasha Tatashin a écrit :
> CONFIG_DEBUG_STACK_USAGE provides a mechanism to know the minimum amount
> of memory that was left in stack. Every time the new anti-record is
> reached a message is printed to the console.
>
> However, this is not useful to know how much each page within stack was
> actually used. Provide a mechanism to count the number of time each
> stack page was reached throughout the live of the stack:

by "this is not useful to know ", you mean "this does not allow us to
know" ?

>
> $ grep kstack /proc/vmstat
> kstack_page_1 19974
> kstack_page_2 94
> kstack_page_3 0
> kstack_page_4 0

That's probably only usefull when THREAD_SIZE is larger than PAGE_SIZE.

On powerpc 8xx, THREAD_SIZE is 8k by default and PAGE_SIZE can be either
4k or 16k.

Christophe