* [PATCH] mm: Remove folio from deferred split list before uncharging it
@ 2024-03-10 13:48 Matthew Wilcox (Oracle)
0 siblings, 0 replies; only message in thread
From: Matthew Wilcox (Oracle) @ 2024-03-10 13:48 UTC (permalink / raw)
To: Andrew Morton; +Cc: Matthew Wilcox (Oracle), linux-mm, Ryan Roberts
When freeing a large folio, we must remove it from the deferred split
list before we uncharge it as each memcg has its own deferred split list
(with associated lock) and removing a folio from the deferred split list
while holding the wrong lock will corrupt that list and cause various
related problems.
Link: https://lore.kernel.org/linux-mm/367a14f7-340e-4b29-90ae-bc3fcefdd5f4@arm.com/
Fixes: f77171d241e3 (mm: allow non-hugetlb large folios to be batch processed)
Debugged-by: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Tested-by: Ryan Roberts <ryan.roberts@arm.com>
---
mm/swap.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/swap.c b/mm/swap.c
index 6b697d33fa5b..7b1d3144391b 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -1012,6 +1012,8 @@ void folios_put_refs(struct folio_batch *folios, unsigned int *refs)
free_huge_folio(folio);
continue;
}
+ if (folio_test_large(folio) && folio_test_large_rmappable(folio))
+ folio_undo_large_rmappable(folio);
__page_cache_release(folio, &lruvec, &flags);
--
2.43.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-03-10 13:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-10 13:48 [PATCH] mm: Remove folio from deferred split list before uncharging it Matthew Wilcox (Oracle)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox