All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pasha Tatashin <pasha.tatashin@soleen.com>
To: lsf-pc@lists.linux-foundation.org
Cc: linux-mm <linux-mm@kvack.org>
Subject: [LSF/MM/BPF TOPIC] Dynamic Growth of Kernel Stacks
Date: Thu, 22 Feb 2024 20:03:37 -0500	[thread overview]
Message-ID: <CA+CK2bBYt9RAVqASB2eLyRQxYT5aiL0fGhUu3TumQCyJCNTWvw@mail.gmail.com> (raw)

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


             reply	other threads:[~2024-02-23  1:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-23  1:03 Pasha Tatashin [this message]
2024-02-23 21:49 ` [LSF/MM/BPF TOPIC] Dynamic Growth of Kernel Stacks 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

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=CA+CK2bBYt9RAVqASB2eLyRQxYT5aiL0fGhUu3TumQCyJCNTWvw@mail.gmail.com \
    --to=pasha.tatashin@soleen.com \
    --cc=linux-mm@kvack.org \
    --cc=lsf-pc@lists.linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.