[PATCH v2 11/14] locking/locktorture: Open-code ww mutex list walk
Kaitao Cheng <[email protected]> Tue, 9 Jun 2026 14:38:52 +0800
| Newsgroups | gmane.linux.kernel.spi.devel,gmane.linux.kernel.drbd.devel,gmane.linux.block,gmane.linux.kernel.firewire.devel,gmane.comp.video.dri.devel,gmane.comp.freedesktop.xorg.drivers.intel,gmane.linux.ports.arm.kernel,gmane.linux.ports.tegra,gmane.linux.sound,gmane.linux.kernel |
|---|---|
| Message-ID | <[email protected]> |
From: Kaitao Cheng <chengkaitao-UOlijcLmZ/[email protected]> 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 <chengkaitao-UOlijcLmZ/[email protected]> --- 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