From: Dmitry Ilvokhin <d@ilvokhin.com>
To: "Artem S. Tashkinov" <aros@gmx.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, david@kernel.org
Subject: Re: mm: tmpfs: huge=always Kconfig help understates severe space amplification
Date: Mon, 2 Nov 2026 12:53:26 +0000 [thread overview]
Message-ID: <auiHxos_Dr1PXEB_@shell.ilvokhin.com> (raw)
In-Reply-To: <b42192af-d9b6-4820-bff3-e3b6c6ce9bf2@gmx.com>
On Sat, Oct 31, 2026 at 03:19:08PM +0000, Artem S. Tashkinov wrote:
> Hi Dmitry,
>
> I'd like to raise a documentation issue with the Kconfig option introduced
> by your patch:
>
> mm: shmem/tmpfs hugepage defaults config choice
>
> Specifically, CONFIG_TRANSPARENT_HUGEPAGE_TMPFS_HUGE_ALWAYS.
>
> The help text currently says:
>
> Always attempt to allocate hugepage for tmpfs mount, can
> increase the memory footprint of applications without a
> guaranteed benefit but it will work automatically for all
> applications.
>
> I believe this substantially understates the potential consequences of
> selecting this option, particularly on general-purpose systems where /tmp is
> mounted as tmpfs.
>
> I recently encountered the following situation while extracting a Fedora
> filesystem tree under /tmp on an x86-64 system running Linux 7.3.
>
> The tmpfs mount had huge=always enabled.
>
> $ df -hT /tmp/Fedora
> Filesystem Type Size Used Avail Use%
> tmpfs tmpfs 48G 47G 925M 99%
>
> $ du -sh /tmp/Fedora/usr
> 45G /tmp/Fedora/usr
>
> $ du -sh --apparent-size /tmp/Fedora/usr
> 1.4G /tmp/Fedora/usr
>
> Even more strikingly:
>
> $ du -sh /tmp/Fedora/usr/share/man/man3
> 7.5G /tmp/Fedora/usr/share/man/man3
>
> $ du -sh --apparent-size /tmp/Fedora/usr/share/man/man3
> 7.8M /tmp/Fedora/usr/share/man/man3
>
> Thus, a directory containing just 7.8 MiB of apparent file data occupied
> approximately 7.5 GiB of allocated space.
>
> The overall tree occupied approximately 45 GiB despite containing only 1.4
> GiB of apparent file data.
>
> This is consistent with severe allocation amplification caused by
> transparent huge pages, although I have not yet established the exact
> breakdown of huge-page allocations and other tmpfs overhead.
Yeah, I think one can expect up to 512 amplification on x86 in the
absolutely worst case, based on the ratio of pages sizes:
2 MiB to 4 KiB.
I suspect the magnitude can be even bigger on aarch64.
[...]
>
> For example, the help might say:
>
> Always attempt hugepage allocation for tmpfs mounts.
>
> WARNING: This policy can substantially increase memory and
> tmpfs space consumption, particularly for workloads creating
> large numbers of small files. Allocated space may greatly
> exceed apparent file sizes, potentially exhausting tmpfs
> capacity even when relatively little file data is stored.
I would probably drop "WARNING", since there nothing to warn about yet.
Also, second sentence communicating the same idea as the first one, but
with different words.
Probably, something like this will be enough: "This policy can
substantially increase memory and tmpfs space consumption, particularly
for workloads creating large numbers of small files."
>
> This setting does not guarantee improved performance and
> should only be selected when its memory overhead is
> understood and acceptable for the intended workload.
This part is already mentioned in the current wording: "increase the
memory footprint of applications without a guaranteed benefit".
Anyway, I think documentation edits are always welcome, please, submit a
patch :)
next prev parent reply other threads:[~2026-11-02 12:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-31 15:19 Artem S. Tashkinov
2026-11-02 12:53 ` Dmitry Ilvokhin [this message]
2026-11-02 13:58 ` David Hildenbrand (Arm)
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=auiHxos_Dr1PXEB_@shell.ilvokhin.com \
--to=d@ilvokhin.com \
--cc=aros@gmx.com \
--cc=david@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®