Thread (37 messages) 37 messages, 4 authors, 2026-06-13
COLD33d

[PATCH v2 11/14] locking/locktorture: Open-code ww mutex list walk

From: Kaitao Cheng <hidden>
Date: 2026-06-09 06:40:29
Also in: dri-devel, intel-gfx, linux-sound, linux-spi, linux-tegra, lkml
Subsystem: the rest, torture-test modules · Maintainers: Linus Torvalds, Davidlohr Bueso, "Paul E. McKenney", Josh Triplett

From: Kaitao Cheng <redacted>

A later change will make list_for_each_entry() cache the next element
before entering the loop body. The ww-mutex torture path can move list
entries while it resolves a wound/wait conflict and then continue from
the adjusted cursor.

Keep the list walk open-coded so the loop step observes the cursor
selected by the body. This preserves the existing stress-test traversal
semantics and prepares the code for the list iterator update.

Signed-off-by: Kaitao Cheng <redacted>
---
 kernel/locking/locktorture.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
index e618bcf75e2d..0eb75e9bccaa 100644
--- a/kernel/locking/locktorture.c
+++ b/kernel/locking/locktorture.c
@@ -644,7 +644,9 @@ __acquires(torture_ww_mutex_2)
 
 	ww_acquire_init(ctx, &torture_ww_class);
 
-	list_for_each_entry(ll, &list, link) {
+	for (ll = list_first_entry(&list, typeof(*ll), link);
+	     !list_entry_is_head(ll, &list, link);
+	     ll = list_next_entry(ll, link)) {
 		int err;
 
 		err = ww_mutex_lock(ll->lock, ctx);
-- 
2.43.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help