Skip to content

Commit 5bb1f4c

Browse files
edliawakpm00
authored andcommitted
Revert "selftests/mm: fix deadlock for fork after pthread_create on ARM"
Patch series "selftests/mm: revert pthread_barrier change" On Android arm, pthread_create followed by a fork caused a deadlock in the case where the fork required work to be completed by the created thread. The previous patches incorrectly assumed that the parent would always initialize the pthread_barrier for the child thread. This reverts the change and replaces the fix for wp-fork-with-event with the original use of atomic_bool. This patch (of 3): This reverts commit e142cc8. fork_event_consumer may be called by other tests that do not initialize the pthread_barrier, so this approach is not correct. The subsequent patch will revert to using atomic_bool instead. Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Fixes: e142cc8 ("fix deadlock for fork after pthread_create on ARM") Signed-off-by: Edward Liaw <[email protected]> Cc: Ryan Roberts <[email protected]> Cc: Peter Xu <[email protected]> Cc: Shuah Khan <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent e8133a7 commit 5bb1f4c

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

tools/testing/selftests/mm/uffd-unit-tests.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,6 @@ static void *fork_event_consumer(void *data)
241241
fork_event_args *args = data;
242242
struct uffd_msg msg = { 0 };
243243

244-
/* Ready for parent thread to fork */
245-
pthread_barrier_wait(&ready_for_fork);
246-
247244
/* Read until a full msg received */
248245
while (uffd_read_msg(args->parent_uffd, &msg));
249246

@@ -311,12 +308,8 @@ static int pagemap_test_fork(int uffd, bool with_event, bool test_pin)
311308

312309
/* Prepare a thread to resolve EVENT_FORK */
313310
if (with_event) {
314-
pthread_barrier_init(&ready_for_fork, NULL, 2);
315311
if (pthread_create(&thread, NULL, fork_event_consumer, &args))
316312
err("pthread_create()");
317-
/* Wait for child thread to start before forking */
318-
pthread_barrier_wait(&ready_for_fork);
319-
pthread_barrier_destroy(&ready_for_fork);
320313
}
321314

322315
child = fork();

0 commit comments

Comments
 (0)