mmtmpfs-consider-end-of-file-write-in-shmem_is_huge.patch removed from -mm tree
The quilt patch titled
Subject: mm,tmpfs: consider end of file write in shmem_is_huge
has been removed from the -mm tree. Its filename was
mmtmpfs-consider-end-of-file-write-in-shmem_is_huge.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Rik van Riel <[email protected]>
Subject: mm,tmpfs: consider end of file write in shmem_is_huge
Date: Tue, 3 Sep 2024 11:19:28 -0400
Take the end of a file write into consideration when deciding whether or not to use huge pages for tmpfs files when the tmpfs filesystem is mounted with huge=within_size
This allows large writes that append to the end of a file to automatically use large pages.
Doing 4MB sequential writes without fallocate to a 16GB tmpfs file with fio. The numbers without THP or with huge=always stay the same, but the performance with huge=within_size now matches that of huge=always.
huge before after
4kB pages 1560 MB/s 1560 MB/swithin_size 1560 MB/s 4720 MB/s
always: 4720 MB/s 4720 MB/s
---
fs/xfs/scrub/xfile.c | 6 +-- fs/xfs/xfs_buf_mem.c | 2 - include/linux/shmem_fs.h | 8 ++--- mm/huge_memory.c | 2 - mm/khugepaged.c | 2 - mm/shmem.c | 59 +++++++++++++++++++------------------ mm/userfaultfd.c | 2 - 7 files changed, 42 insertions(+), 39 deletions(-)
fs/xfs/scrub/xfile.c renamed from fs/xfs/scrub/xfile.c~mmtmpfs-consider-end-of-file-write-in-shmem_is_huge +3 -3
@@ -126,7 +126,7 @@ xfile_load(unsigned int len;unsigned int offset; -if (shmem_get_folio (inode, pos >>PAGE_SHIFT , &folio, +if (shmem_get_folio (inode, pos >>PAGE_SHIFT ,0 , &folio,SGP_READ ) <0 )break ;if (!folio) {
@@ -196,7 +196,7 @@ xfile_store(unsigned int len;unsigned int offset; -if (shmem_get_folio (inode, pos >>PAGE_SHIFT , &folio, +if (shmem_get_folio (inode, pos >>PAGE_SHIFT ,0 , &folio,SGP_CACHE ) <0 )break ;if (filemap_check_wb_err (inode->i_mapping,0 )) {
@@ -267,7 +267,7 @@ xfile_get_folio(i_size_write (inode, pos + len); pflags =memalloc_nofs_save (); - error =shmem_get_folio (inode, pos >>PAGE_SHIFT , &folio, + error =shmem_get_folio (inode, pos >>PAGE_SHIFT ,0 , &folio, (flags &XFILE_ALLOC ) ?SGP_CACHE :SGP_READ );memalloc_nofs_restore (pflags);if (error)
fs/xfs/xfs_buf_mem.c renamed from fs/xfs/xfs_buf_mem.c~mmtmpfs-consider-end-of-file-write-in-shmem_is_huge +1 -1
@@ -149,7 +149,7 @@ xmbuf_map_page(return -ENOMEM ; } - error =shmem_get_folio (inode, pos >>PAGE_SHIFT , &folio,SGP_CACHE ); + error =shmem_get_folio (inode, pos >>PAGE_SHIFT ,0 , &folio,SGP_CACHE );if (error)return error;
include/linux/shmem_fs.h renamed from include/linux/shmem_fs.h~mmtmpfs-consider-end-of-file-write-in-shmem_is_huge +4 -4
@@ -113,11 +113,11 @@ int shmem_unuse(unsigned int type);#ifdef CONFIG_TRANSPARENT_HUGEPAGE unsigned long shmem_allowable_huge_orders (struct inode *inode,struct vm_area_struct *vma,pgoff_t index, -bool shmem_huge_force); +loff_t write_end,bool shmem_huge_force);#else static inline unsigned long shmem_allowable_huge_orders (struct inode *inode,struct vm_area_struct *vma,pgoff_t index, -bool shmem_huge_force) +loff_t write_end,bool shmem_huge_force) {return 0 ; }
@@ -143,8 +143,8 @@ enum sgp_type { SGP_FALLOC, /* like SGP_WRITE, but make existing page Uptodate */ }; -int shmem_get_folio (struct inode *inode,pgoff_t index,struct folio **foliop, -enum sgp_type sgp); +int shmem_get_folio (struct inode *inode,pgoff_t index,loff_t write_end, +struct folio **foliop,enum sgp_type sgp);struct folio *shmem_read_folio_gfp (struct address_space *mapping,pgoff_t index,gfp_t gfp);
mm/huge_memory.c renamed from mm/huge_memory.c~mmtmpfs-consider-end-of-file-write-in-shmem_is_huge +1 -1
@@ -164,7 +164,7 @@ unsigned long __thp_vma_allowable_orders*/ if (!in_pf &&shmem_file (vma->vm_file))return shmem_allowable_huge_orders (file_inode (vma->vm_file), - vma, vma->vm_pgoff, + vma, vma->vm_pgoff,0 , !enforce_sysfs);if (!vma_is_anonymous (vma)) {
mm/khugepaged.c renamed from mm/khugepaged.c~mmtmpfs-consider-end-of-file-write-in-shmem_is_huge +1 -1
@@ -1870,7 +1870,7 @@ static int collapse_file(struct mm_strucif (xa_is_value (folio) || !folio_test_uptodate (folio)) {xas_unlock_irq (&xas);/* swap in or instantiate fallocated page */ -if (shmem_get_folio (mapping->host, index, +if (shmem_get_folio (mapping->host, index,0 , &folio,SGP_NOALLOC )) { result =SCAN_FAIL ; goto xa_unlocked;
mm/shmem.c renamed from mm/shmem.c~mmtmpfs-consider-end-of-file-write-in-shmem_is_huge +31 -28
184 lines not on this page · raw message
mm/userfaultfd.c renamed from mm/userfaultfd.c~mmtmpfs-consider-end-of-file-write-in-shmem_is_huge +1 -1
@@ -391,7 +391,7 @@ static int mfill_atomic_pte_continue(pmdstruct page *page;int ret; - ret =shmem_get_folio (inode, pgoff, &folio,SGP_NOALLOC ); + ret =shmem_get_folio (inode, pgoff,0 , &folio,SGP_NOALLOC );/* Our caller expects us to return -EFAULT if we failed to find folio */ if (ret == -ENOENT ) ret = -EFAULT ;
_
Patches currently in -mm which might be from [email protected] are