Skip to content

Commit e384200

Browse files
Hugh Dickinsakpm00
authored andcommitted
mm/shmem: fix shmem folio swapoff hang
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@google.com Fixes: da08e9b ("mm/shmem: convert shmem_swapin_page() to shmem_swapin_folio()") Signed-off-by: Hugh Dickins <hughd@google.com> Reviewed-by: Miaohe Lin <linmiaohe@huawei.com> Tested-by: Miaohe Lin <linmiaohe@huawei.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 7fb6378 commit e384200

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

mm/shmem.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,6 @@ static int shmem_find_swap_entries(struct address_space *mapping,
11641164
XA_STATE(xas, &mapping->i_pages, start);
11651165
struct folio *folio;
11661166
swp_entry_t entry;
1167-
unsigned int ret = 0;
11681167

11691168
rcu_read_lock();
11701169
xas_for_each(&xas, folio, ULONG_MAX) {
@@ -1178,7 +1177,7 @@ static int shmem_find_swap_entries(struct address_space *mapping,
11781177
if (swp_type(entry) != type)
11791178
continue;
11801179

1181-
indices[ret] = xas.xa_index;
1180+
indices[folio_batch_count(fbatch)] = xas.xa_index;
11821181
if (!folio_batch_add(fbatch, folio))
11831182
break;
11841183

0 commit comments

Comments
 (0)