[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <c32bee8a-f0aa-245-f94e-24dd271924fa@google.com>
Date: Sat, 21 May 2022 19:53:04 -0700 (PDT)
From: Hugh Dickins <hughd@...gle.com>
To: Matthew Wilcox <willy@...radead.org>
cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: [PATCH next] 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.
Fixes: da08e9b79323 ("mm/shmem: convert shmem_swapin_page() to shmem_swapin_folio()")
Signed-off-by: Hugh Dickins <hughd@...gle.com>
---
mm/shmem.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1171,7 +1171,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) {
@@ -1189,7 +1188,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;
Powered by blists - more mailing lists