- uatomic_dec(&gp_futex);
- force_mb_single_thread(index); /* Write futex before read reader_gp */
- if (!rcu_old_gp_ongoing(&index->ctr)) {
- /* Read reader_gp before write futex */
- force_mb_single_thread(index);
- /* Callbacks are queued, don't wait. */
- uatomic_set(&gp_futex, 0);
- } else {
- /* Read reader_gp before read futex */
- force_mb_single_thread(index);
- if (uatomic_read(&gp_futex) == -1)
- futex(&gp_futex, FUTEX_WAIT, -1,
- NULL, NULL, 0);
- }
+ /* Read reader_gp before read futex */
+ smp_mb_master(RCU_MB_GROUP);
+ if (uatomic_read(&gp_futex) == -1)
+ futex_async(&gp_futex, FUTEX_WAIT, -1,
+ NULL, NULL, 0);