[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tencent_14CA2C6995E7C11795D4F60E656AD9422C06@qq.com>
Date: Tue, 16 Dec 2025 17:19:02 +0800
From: Licay <licayy@...mail.com>
To: ywen.chen@...mail.com,
akpm@...ux-foundation.org
Cc: andrealmeid@...lia.com,
bigeasy@...utronix.de,
colin.i.king@...il.com,
dave@...olabs.net,
dvhart@...radead.org,
justinstitt@...gle.com,
kernel-team@...roid.com,
linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org,
luto@....edu,
mingo@...hat.com,
morbo@...gle.com,
nathan@...nel.org,
ndesaulniers@...gle.com,
peterz@...radead.org,
shuah@...nel.org,
tglx@...utronix.de,
usama.anjum@...labora.com,
Licay <licayy@...mail.com>
Subject: [PATCH v2 5/5] selftests/futex: fix the issue of abnormal test results caused by thread timing
> Fixes a race between parent and child threads in futex_requeue.
>
> Similar to commit fbf4dec70277 ("selftests/futex: Order calls to
> futex_lock_pi"), which fixed a flake in futex_lock_pi due to racing
> between the parent and child threads.
>
> The same issue can occur in the futex_requeue test, because it expects
> waiterfn to make progress to futex_wait before the parent starts to
> requeue. This is mitigated by the parent sleeping for WAKE_WAIT_US, but
> it still fails occasionally. This can be reproduced by adding a sleep in
> the waiterfn before futex_wait:
>
> TAP version 13
> 1..2
> not ok 1 futex_requeue simple returned: 0
> not ok 2 futex_requeue simple returned: 0
> not ok 3 futex_requeue many returned: 0
> not ok 4 futex_requeue many returned: 0
>
> This issue can be resolved by checking whether the child thread is in a
> sleeping state. This is because when the child thread goes to sleep, it
> indicates that it is waiting for the futex lock.
>
> Fixes: 7cb5dd8e2c8c ("selftests: futex: Add futex compare requeue test")
> Signed-off-by: Yuwen Chen <ywen.chen@...mail.com>
> Co-developed-by: Edward Liaw <edliaw@...gle.com>
> Signed-off-by: Edward Liaw <edliaw@...gle.com>
> ---
> .../futex/functional/futex_requeue.c | 58 ++++++++++++++++---
> 1 file changed, 51 insertions(+), 7 deletions(-)
Reviewed-by: Licay <licayy@...mail.com>
Powered by blists - more mailing lists