From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: akpm@linux-foundation.org, hughd@google.com
Cc: willy@infradead.org, david@redhat.com, 21cnbao@gmail.com,
ryan.roberts@arm.com, ziy@nvidia.com, ioworker0@gmail.com,
da.gomez@samsung.com, p.raghav@samsung.com,
baolin.wang@linux.alibaba.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: [RFC PATCH 0/3] Support large folios for tmpfs
Date: Wed, 24 Jul 2024 15:03:57 +0800 [thread overview]
Message-ID: <cover.1721720891.git.baolin.wang@linux.alibaba.com> (raw)
Hi,
This RFC patch series attempts to support large folios for tmpfs. The first
two patches are based on Daniel's previous patches in [1], mainly using the
length in the write and fallocate paths to get a highest order hint for large
order allocation. The last patch adds mTHP filter control for tmpfs if mTHP
is set for the following reasons:
1. Maintain backward compatibility for the control interface. Tmpfs already
has a global 'huge=' mount option and '/sys/kernel/mm/transparent_hugepage/shmem_enabled'
interface to control large order allocations. mTHP extends this capability to a
per-size basis while maintaining good interface compatibility.
2. For the large order allocation of writable mmap() faults in tmpfs, we need
something like the mTHP interfaces to control large orders, as well as ensuring
consistent interfaces with shmem.
3. Ryan pointed out that large order allocations based on write length could
lead to memory fragmentation issue. Just quoting Ryan's comment [2]:
"And it's possible (likely even, in my opinion) that allocating lots of different
folio sizes will exacerbate memory fragmentation, leading to more order-0
fallbacks, which would hurt the overall system performance in the long run, vs
restricting to a couple of folio sizes."
4. Some hardware preferences, such as for the ARM64 architecture, can better
utilize the cont-pte feature to reduce TLB pressure and optimize performance with
a 64K size folio. Using mTHP can better leverage these hardware advantages.
Please correct me if I missed something. Thanks a lot.
[1] https://lore.kernel.org/all/20240515055719.32577-1-da.gomez@samsung.com/
[2] https://lore.kernel.org/all/e83e1687-3e3c-40d0-bf0e-225871647092@arm.com/
Baolin Wang (1):
mm: shmem: use mTHP interface to control huge orders for tmpfs
Daniel Gomez (2):
mm: shmem: add file length arg in shmem_get_folio() path
mm: shmem: add large folio support to the write and fallocate paths
fs/xfs/scrub/xfile.c | 6 +--
fs/xfs/xfs_buf_mem.c | 3 +-
include/linux/shmem_fs.h | 6 +--
mm/huge_memory.c | 2 +-
mm/khugepaged.c | 3 +-
mm/memory.c | 4 +-
mm/shmem.c | 101 +++++++++++++++++++++++++++++----------
mm/userfaultfd.c | 2 +-
8 files changed, 91 insertions(+), 36 deletions(-)
--
2.39.3
next reply other threads:[~2024-07-24 7:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-24 7:03 Baolin Wang [this message]
2024-07-24 7:03 ` [RFC PATCH 1/3] mm: shmem: add file length arg in shmem_get_folio() path Baolin Wang
2024-07-24 7:03 ` [RFC PATCH 2/3] mm: shmem: add large folio support to the write and fallocate paths Baolin Wang
2024-08-04 18:46 ` Daniel Gomez
2024-08-08 1:56 ` Baolin Wang
2024-07-24 7:04 ` [RFC PATCH 3/3] mm: shmem: use mTHP interface to control huge orders for tmpfs Baolin Wang
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=cover.1721720891.git.baolin.wang@linux.alibaba.com \
--to=baolin.wang@linux.alibaba.com \
--cc=21cnbao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=da.gomez@samsung.com \
--cc=david@redhat.com \
--cc=hughd@google.com \
--cc=ioworker0@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=p.raghav@samsung.com \
--cc=ryan.roberts@arm.com \
--cc=willy@infradead.org \
--cc=ziy@nvidia.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