From: Peter Collingbourne <pcc@google.com>
To: Pasha Tatashin <pasha.tatashin@soleen.com>,
Alexandru Elisei <alexandru.elisei@arm.com>,
David Hildenbrand <david@redhat.com>
Cc: lsf-pc@lists.linux-foundation.org, "cc: linux-mm" <linux-mm@kvack.org>
Subject: Re: [LSF/MM/BPF TOPIC] Dynamic Growth of Kernel Stacks
Date: Fri, 23 Feb 2024 13:49:08 -0800 [thread overview]
Message-ID: <CAMn1gO7ELoF+MdUco46ck_-kd99Tdjnf0y8SCevzFDjVfXXpjw@mail.gmail.com> (raw)
In-Reply-To: <CA+CK2bBYt9RAVqASB2eLyRQxYT5aiL0fGhUu3TumQCyJCNTWvw@mail.gmail.com>
On Thu, Feb 22, 2024, 17:04 Pasha Tatashin <pasha.tatashin@soleen.com> wrote:
>
> 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
Hi Pasha,
I wonder if this is another potential use case for bringing back
cleancache, as proposed in [1]? The idea would be that all kernel
stacks have 16KB allocations but only one page accessible and the rest
available as cleancache. We can handle a fault on one of those pages
by discarding the cleancache page and remapping it as r/w.
Peter
[1] https://lore.kernel.org/all/ZdSMbjGf2Fj98diT@raptor/
next prev parent reply other threads:[~2024-02-23 21:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-23 1:03 Pasha Tatashin
2024-02-23 21:49 ` Peter Collingbourne [this message]
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=CAMn1gO7ELoF+MdUco46ck_-kd99Tdjnf0y8SCevzFDjVfXXpjw@mail.gmail.com \
--to=pcc@google.com \
--cc=alexandru.elisei@arm.com \
--cc=david@redhat.com \
--cc=linux-mm@kvack.org \
--cc=lsf-pc@lists.linux-foundation.org \
--cc=pasha.tatashin@soleen.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