On 15/10/21 18:12, Greg Kurz wrote:
+/*
+ * NotifierList used to force an RCU grace period.  Accessed under
+ * rcu_registry_lock.
+ */
+static NotifierList force_rcu_notifiers =
+    NOTIFIER_LIST_INITIALIZER(force_rcu_notifiers);
+
  /*
   * Check whether a quiescent state was crossed between the beginning of
   * update_counter_and_wait and now.
@@ -107,6 +115,8 @@ static void wait_for_readers(void)
                   * get some extra futex wakeups.
                   */
                  qatomic_set(&index->waiting, false);
+            } else if (qatomic_read(&in_drain_call_rcu)) {
+                notifier_list_notify(&force_rcu_notifiers, NULL);
              }
          }

You can put the notifier in struct rcu_reader_data---this way it doesn't call all the notifiers but only those that are necessary to make progress.

While at it, I have a slight preference for a separate rcu_add_force_rcu_notifier API, but I can be convinced otherwise. :)

Paolo


Reply via email to