Skip to content

Improve the tmpfs large folio read performance

Baolin Wang linux-mm lkml 2 versions – Applied

Status from this message: [merged mm-stable] mm-shmem-improve-the-tmpfs-large-folio-read-performance.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 2 repliesApplied 2/2
  2. v12 patches 10 repliesSuperseded

Changes in v2 from the cover letter

- Move index calculation to the appropriate place, per Kefeng.
- Fallback to page copy if large folio has poisoned subpages, suggested by Matthew and Yang.

Patches in v2 All 2 applied

#Subject and filesSizeRepliesApplied
1/2mm: shmem: update iocb->ki_pos directly to simplify tmpfs read logicmm/shmem.c+11 -241 replyApplied
2/2mm: shmem: improve the tmpfs large folio read performancemm/shmem.c+24 -101 replyApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/2] Improve the tmpfs large folio read performance

The tmpfs has already supported the PMD-sized large folios, but the tmpfs read operation still performs copying at the PAGE SIZE granularity, which is not perfect. This patch changes to copy data at the folio granularity, which can improve the read performance.

Use 'fio bs=64k' to read a 1G tmpfs file populated with 2M THPs, and I can see about 20% performance improvement, and no regression with bs=4k. I also did some functional test with the xfstests suite, and I did not find any regressions with the following xfstests config.
FSTYP=tmpfs
export TEST_DIR=/mnt/tempfs_mnt
export TEST_DEV=/mnt/tempfs_mnt
export SCRATCH_MNT=/mnt/scratchdir
export SCRATCH_DEV=/mnt/scratchdir

Changes from v1:
- Move index calculation to the appropriate place, per Kefeng.
- Fallback to page copy if large folio has poisoned subpages, suggested by Matthew and Yang.

Baolin Wang (2):
mm: shmem: update iocb->ki_pos directly to simplify tmpfs read logic
mm: shmem: improve the tmpfs large folio read performance

 mm/shmem.c | 65 +++++++++++++++++++++++++++---------------------------
 1 file changed, 33 insertions(+), 32 deletions(-)
Signature · 1 line
2.39.3