Thread (38 messages) 38 messages, 4 authors, 2025-01-24
STALE551d
Revisions (5)
  1. v1 [diff vs current]
  2. v2 [diff vs current]
  3. v3 [diff vs current]
  4. v4 [diff vs current]
  5. v5 current

[PATCH v5 26/32] Display waited-on page index after 1min of waiting

From: David Howells <dhowells@redhat.com>
Date: 2024-12-16 20:44:55
Also in: ceph-devel, linux-cifs, linux-fsdevel, linux-mm, linux-nfs, lkml, netfs, v9fs
Subsystem: memory management, page cache, the rest · Maintainers: Andrew Morton, Matthew Wilcox, Jan Kara, Linus Torvalds

---
 mm/filemap.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/mm/filemap.c b/mm/filemap.c
index f61cf51c2238..1b6ab9915bc8 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1236,6 +1236,8 @@ static inline int folio_wait_bit_common(struct folio *folio, int bit_nr,
 	bool thrashing = false;
 	unsigned long pflags;
 	bool in_thrashing;
+	pgoff_t index = folio->index;
+	long timeout = 60 * HZ;
 
 	if (bit_nr == PG_locked &&
 	    !folio_test_uptodate(folio) && folio_test_workingset(folio)) {
@@ -1305,7 +1307,14 @@ static inline int folio_wait_bit_common(struct folio *folio, int bit_nr,
 			if (signal_pending_state(state, current))
 				break;
 
-			io_schedule();
+			if (timeout > 0) {
+				timeout = io_schedule_timeout(timeout);
+				if (timeout <= 0)
+					pr_warn("folio wait took too long (ix=%lx)\n",
+						index);
+			} else {
+				io_schedule();
+			}
 			continue;
 		}
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help