From: Shakeel Butt <shakeel.butt@linux.dev>
To: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: akpm@linux-foundation.org, jpoimboe@kernel.org,
kent.overstreet@linux.dev, peterz@infradead.org,
nphamcs@gmail.com, cerasuolodomenico@gmail.com,
surenb@google.com, lizhijian@fujitsu.com, willy@infradead.org,
vbabka@suse.cz, ziy@nvidia.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [PATCH v5 2/3] vmstat: Kernel stack usage histogram
Date: Wed, 24 Jul 2024 13:49:14 -0700 [thread overview]
Message-ID: <mpbxc7boje4aun4pzfoipz2hwaeq75rg3kl2epdpenq5hhomyn@6uj6brlaujwc> (raw)
In-Reply-To: <20240724203322.2765486-3-pasha.tatashin@soleen.com>
On Wed, Jul 24, 2024 at 08:33:21PM GMT, Pasha Tatashin wrote:
> As part of the dynamic kernel stack project, we need to know the amount
> of data that can be saved by reducing the default kernel stack size [1].
>
> Provide a kernel stack usage histogram to aid in optimizing kernel stack
> sizes and minimizing memory waste in large-scale environments. The
> histogram divides stack usage into power-of-two buckets and reports the
> results in /proc/vmstat. This information is especially valuable in
> environments with millions of machines, where even small optimizations
> can have a significant impact.
>
> The histogram data is presented in /proc/vmstat with entries like
> "kstack_1k", "kstack_2k", and so on, indicating the number of threads
> that exited with stack usage falling within each respective bucket.
>
> Example outputs:
> Intel:
> $ grep kstack /proc/vmstat
> kstack_1k 3
> kstack_2k 188
> kstack_4k 11391
> kstack_8k 243
> kstack_16k 0
>
> ARM with 64K page_size:
> $ grep kstack /proc/vmstat
> kstack_1k 1
> kstack_2k 340
> kstack_4k 25212
> kstack_8k 1659
> kstack_16k 0
> kstack_32k 0
> kstack_64k 0
>
> Note: once the dynamic kernel stack is implemented it will depend on the
> implementation the usability of this feature: On hardware that supports
> faults on kernel stacks, we will have other metrics that show the total
> number of pages allocated for stacks. On hardware where faults are not
> supported, we will most likely have some optimization where only some
> threads are extended, and for those, these metrics will still be very
> useful.
>
> [1] https://lwn.net/Articles/974367
>
> Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
> Reviewed-by: Kent Overstreet <kent.overstreet@linux.dev>
Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
next prev parent reply other threads:[~2024-07-24 20:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-24 20:33 [PATCH v5 0/3] " Pasha Tatashin
2024-07-24 20:33 ` [PATCH v5 1/3] memcg: increase the valid index range for memcg stats Pasha Tatashin
2024-07-24 23:17 ` Yosry Ahmed
2024-07-25 14:25 ` Pasha Tatashin
2024-07-24 20:33 ` [PATCH v5 2/3] vmstat: Kernel stack usage histogram Pasha Tatashin
2024-07-24 20:49 ` Shakeel Butt [this message]
2024-07-24 20:33 ` [PATCH v5 3/3] task_stack: uninline stack_not_used Pasha Tatashin
2024-07-24 20:50 ` Shakeel Butt
2024-07-25 14:30 ` Pasha Tatashin
2024-07-25 15:57 ` Shakeel Butt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=mpbxc7boje4aun4pzfoipz2hwaeq75rg3kl2epdpenq5hhomyn@6uj6brlaujwc \
--to=shakeel.butt@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=cerasuolodomenico@gmail.com \
--cc=jpoimboe@kernel.org \
--cc=kent.overstreet@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lizhijian@fujitsu.com \
--cc=nphamcs@gmail.com \
--cc=pasha.tatashin@soleen.com \
--cc=peterz@infradead.org \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox