]> www.infradead.org Git - users/dwmw2/linux.git/commit
mm: shmem: improve the tmpfs large folio read performance
authorBaolin Wang <baolin.wang@linux.alibaba.com>
Fri, 18 Oct 2024 03:00:28 +0000 (11:00 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 7 Nov 2024 04:11:17 +0000 (20:11 -0800)
commita284cb8472ec6bb027ebf3b936385601d8a8f414
tree5035d64755edec78c2a523c4ce1727ff6fbef01e
parentf3650ef89b879d63c63f04e98481f7ed4df1119a
mm: shmem: improve the tmpfs large folio read performance

tmpfs already supports PMD-sized large folios, but the tmpfs read
operation still performs copying at PAGE_SIZE granularity, which is
unreasonable.  This patch changes tmpfs to copy data at folio granularity,
which can improve the read performance, as well as changing to use folio
related functions.

Moreover, if a large folio has a subpage that is hwpoisoned, it will
still fall back to page granularity copying.

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.
Before the patch:
READ: bw=10.0GiB/s

After the patch:
READ: bw=12.0GiB/s

Link: https://lkml.kernel.org/r/2129a21a5b9f77d3bb7ddec152c009ce7c5653c4.1729218573.git.baolin.wang@linux.alibaba.com
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Reviewed-by: Yang Shi <shy828301@gmail.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/shmem.c