diff options
author | Hugh Dickins <hughd@google.com> | 2022-05-21 19:53:04 -0700 |
---|---|---|
committer | akpm <akpm@linux-foundation.org> | 2022-05-25 10:47:47 -0700 |
commit | e384200e70664cd690cdadb72b2a1bc9dfcdec1a (patch) | |
tree | ac6e344668f89e63d722e1a0b3798011dc0f800f /mm/shmem.c | |
parent | 7fb6378701dc0d8f19c1ac4623b55f5125f0e286 (diff) | |
download | lwn-e384200e70664cd690cdadb72b2a1bc9dfcdec1a.tar.gz lwn-e384200e70664cd690cdadb72b2a1bc9dfcdec1a.zip |
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: da08e9b79323 ("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>
Diffstat (limited to 'mm/shmem.c')
-rw-r--r-- | mm/shmem.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index 7f41a24ed382..b8169beff226 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1164,7 +1164,6 @@ static int shmem_find_swap_entries(struct address_space *mapping, 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) { @@ -1178,7 +1177,7 @@ static int shmem_find_swap_entries(struct address_space *mapping, 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; |