The patch titled Subject: mm/shmem: fix shmem folio swapoff hang has been added to the -mm mm-stable branch. Its filename is mm-shmem-fix-shmem-folio-swapoff-hang.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-shmem-fix-shmem-folio-swapoff-hang.patch This patch will later appear in the mm-stable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Hugh Dickins <hughd@xxxxxxxxxx> Subject: mm/shmem: fix shmem folio swapoff hang Date: Sat, 21 May 2022 19:53:04 -0700 (PDT) Shmem swapoff makes no progress: the index to indices is not incremented. But "ret" is no longer a return value, so use folio_batch_count() instead. Link: https://lkml.kernel.org/r/c32bee8a-f0aa-245-f94e-24dd271924fa@xxxxxxxxxx Fixes: da08e9b79323 ("mm/shmem: convert shmem_swapin_page() to shmem_swapin_folio()") Signed-off-by: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Cc: Christoph Hellwig <hch@xxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/shmem.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/mm/shmem.c~mm-shmem-fix-shmem-folio-swapoff-hang +++ a/mm/shmem.c @@ -1165,7 +1165,6 @@ static int shmem_find_swap_entries(struc XA_STATE(xas, &mapping->i_pages, start); struct folio *folio; swp_entry_t entry; - unsigned int ret = 0; rcu_read_lock(); xas_for_each(&xas, folio, ULONG_MAX) { @@ -1179,7 +1178,7 @@ static int shmem_find_swap_entries(struc if (swp_type(entry) != type) continue; - indices[ret] = xas.xa_index; + indices[folio_batch_count(fbatch)] = xas.xa_index; if (!folio_batch_add(fbatch, folio)) break; _ Patches currently in -mm which might be from hughd@xxxxxxxxxx are mm-shmem-fix-shmem-folio-swapoff-hang.patch