Re: THP backed thread stacks

From: David Hildenbrand
Date: Tue Mar 07 2023 - 05:11:21 EST


On 07.03.23 00:57, Mike Kravetz wrote:
One of our product teams recently experienced 'memory bloat' in their
environment. The application in this environment is the JVM which
creates hundreds of threads. Threads are ultimately created via
pthread_create which also creates the thread stacks. pthread attributes
are modified so that stacks are 2MB in size. It just so happens that
due to allocation patterns, all their stacks are at 2MB boundaries.

Is this also related to a recent change, where we try to always align at PMD boundaries now, such that this gets more likely?

commit f35b5d7d676e59e401690b678cd3cfec5e785c23
Author: Rik van Riel <riel@xxxxxxxxxxx>
Date: Tue Aug 9 14:24:57 2022 -0400

mm: align larger anonymous mappings on THP boundaries


As a side note, I even heard of complains about memory bloat when switching from 4k -> 64k page size with many threads ...

--
Thanks,

David / dhildenb