mm-shmem-use-swap_free_nr-to-free-shmem-swap-entries.patch removed from -mm tree
The quilt patch titled
Subject: mm: shmem: use swap_free_nr() to free shmem swap entries
has been removed from the -mm tree. Its filename was
mm-shmem-use-swap_free_nr-to-free-shmem-swap-entries.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: Baolin Wang <[email protected]>
Subject: mm: shmem: use swap_free_nr() to free shmem swap entries
Date: Mon, 12 Aug 2024 15:42:06 +0800
As a preparation for supporting shmem large folio swapout, use swap_free_nr() to free some continuous swap entries of the shmem large folio when the large folio was swapped in from the swap cache. In addition, the index should also be round down to the number of pages when adding the swapin folio into the pagecache.
---
mm/shmem.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
mm/shmem.c renamed from mm/shmem.c~mm-shmem-use-swap_free_nr-to-free-shmem-swap-entries +10 -6
@@ -1961,6 +1961,7 @@ static void shmem_set_folio_swapin_errorstruct address_space *mapping = inode->i_mapping;swp_entry_t swapin_error;void *old; +int nr_pages; swapin_error =make_poisoned_swp_entry (); old = xa_cmpxchg_irq(&mapping->i_pages, index,
@@ -1969,6 +1970,7 @@ static void shmem_set_folio_swapin_errorif (old !=swp_to_radix_entry (swap))return ; + nr_pages =folio_nr_pages (folio);folio_wait_writeback (folio);delete_from_swap_cache (folio);/*
@@ -1976,8 +1978,8 @@ static void shmem_set_folio_swapin_error* won't be 0 when inode is released and thus trigger WARN_ON(i_blocks) * in shmem_evict_inode(). */ -shmem_recalc_inode (inode,-1 ,-1 ); -swap_free (swap); +shmem_recalc_inode (inode, -nr_pages, -nr_pages); +swap_free_nr (swap, nr_pages); }/*
@@ -1996,7 +1998,7 @@ static int shmem_swapin_folio(struct inostruct swap_info_struct *si;struct folio *folio =NULL ;swp_entry_t swap; -int error; +int error, nr_pages;VM_BUG_ON (!*foliop || !xa_is_value (*foliop)); swap =radix_to_swp_entry (*foliop);
@@ -2043,6 +2045,7 @@ static int shmem_swapin_folio(struct ino goto failed; }folio_wait_writeback (folio); + nr_pages =folio_nr_pages (folio);/* * Some architectures may have to restore extra metadata to the
@@ -2056,19 +2059,20 @@ static int shmem_swapin_folio(struct ino goto failed; } - error =shmem_add_to_page_cache (folio, mapping, index, + error =shmem_add_to_page_cache (folio, mapping, +round_down (index, nr_pages),swp_to_radix_entry (swap), gfp);if (error) goto failed; -shmem_recalc_inode (inode,0 ,-1 ); +shmem_recalc_inode (inode,0 , -nr_pages);if (sgp ==SGP_WRITE )folio_mark_accessed (folio);delete_from_swap_cache (folio);folio_mark_dirty (folio); -swap_free (swap); +swap_free_nr (swap, nr_pages);put_swap_device (si); *foliop = folio;
_
Patches currently in -mm which might be from [email protected] are