linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [LSF/MM/BPF TOPIC] Dynamic Growth of Kernel Stacks
@ 2024-02-23  1:03 Pasha Tatashin
  2024-02-23 21:49 ` Peter Collingbourne
  2024-04-30 13:07 ` [Lsf-pc] " Michal Hocko
  0 siblings, 2 replies; 7+ messages in thread
From: Pasha Tatashin @ 2024-02-23  1:03 UTC (permalink / raw)
  To: lsf-pc; +Cc: linux-mm

For a long time, an 8K kernel stack was large enough. However, since
2014, the default stack size has increased to 16K [1]. To conserve
memory at Google, we maintained 8K stacks via a custom patch while
verifying that our workload could fit within this limit.

As we qualify new workloads and kernels, we find it more difficult to
keep the stacks at 8K. Therefore, we will increase the stack size to
the mainline value of 16K. However, this translates to a significant
increase in memory usage, potentially counted in petabytes.

With virtually mapped stacks [2], it's possible to implement
auto-growth on faults. Ideally, the vast majority of kernel threads
could fit into 4K or 8K stacks, with only a small number requiring
deeper stacks that would expand as needed.

The complication is that new pages must always be available from
within an interrupt context. To ensure this, pages must be accessible
to kernel threads in an atomic and lockless manner. This could be
achieved by using a per-CPU supply of pages dedicated to handling
kernel-stack faults.

[1] https://lwn.net/Articles/600644
[2] https://lwn.net/Articles/692608


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-05-02  7:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-23  1:03 [LSF/MM/BPF TOPIC] Dynamic Growth of Kernel Stacks Pasha Tatashin
2024-02-23 21:49 ` Peter Collingbourne
2024-02-23 21:56   ` Matthew Wilcox
2024-02-23 22:01     ` Peter Collingbourne
2024-04-30 13:07 ` [Lsf-pc] " Michal Hocko
2024-05-01  0:20   ` Pasha Tatashin
2024-05-02  7:19     ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox