Thread (17 messages) 17 messages, 5 authors, 2025-04-04

Re: [PATCH 1/3] mm/migrate: add might_sleep() on __migrate_folio()

From: Matthew Wilcox <willy@infradead.org>
Date: 2025-03-30 12:04:14
Also in: linux-ext4, linux-fsdevel, linux-mm

On Sat, Mar 29, 2025 at 11:47:30PM -0700, Luis Chamberlain wrote:
However tracing shows that folio_mc_copy() *isn't* being called
as often as we'd expect from buffer_migrate_folio_norefs() path
as we're likely bailing early now thanks to the check added by commit
060913999d7a ("mm: migrate: support poisoned recover from migrate
folio").
Umm.  You're saying that most folios we try to migrate have extra refs?
That seems unexpected; does it indicate a bug in 060913999d7a?
quoted hunk ↗ jump to hunk
+++ b/mm/migrate.c
@@ -751,6 +751,8 @@ static int __migrate_folio(struct address_space *mapping, struct folio *dst,
 {
 	int rc, expected_count = folio_expected_refs(mapping, src);
 
+	might_sleep();
We deliberately don't sleep when the folio is only a single page.
So this needs to be:

	might_sleep_if(folio_test_large(folio));
 	/* Check whether src does not have extra refs before we do more work */
 	if (folio_ref_count(src) != expected_count)
 		return -EAGAIN;
-- 
2.47.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help