rcu: Add data structures for synchronize_rcu()
authorUladzislau Rezki (Sony) <urezki@gmail.com>
Fri, 8 Mar 2024 17:34:04 +0000 (18:34 +0100)
committerUladzislau Rezki (Sony) <urezki@gmail.com>
Thu, 11 Apr 2024 15:57:15 +0000 (17:57 +0200)
The synchronize_rcu() call is going to be reworked, thus
this patch adds dedicated fields into the rcu_state structure.

Reviewed-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
kernel/rcu/tree.h

index df48160b3136dca1b668a3e0d275832ccc273dd3..b942b94374382ed8e23a34863cc1e7689640446f 100644 (file)
@@ -315,6 +315,13 @@ do {                                                                       \
        __set_current_state(TASK_RUNNING);                              \
 } while (0)
 
+#define SR_NORMAL_GP_WAIT_HEAD_MAX 5
+
+struct sr_wait_node {
+       atomic_t inuse;
+       struct llist_node node;
+};
+
 /*
  * RCU global state, including node hierarchy.  This hierarchy is
  * represented in "heap" form in a dense array.  The root (first level)
@@ -400,6 +407,13 @@ struct rcu_state {
                                                /* Synchronize offline with */
                                                /*  GP pre-initialization. */
        int nocb_is_setup;                      /* nocb is setup from boot */
+
+       /* synchronize_rcu() part. */
+       struct llist_head srs_next;     /* request a GP users. */
+       struct llist_node *srs_wait_tail; /* wait for GP users. */
+       struct llist_node *srs_done_tail; /* ready for GP users. */
+       struct sr_wait_node srs_wait_nodes[SR_NORMAL_GP_WAIT_HEAD_MAX];
+       struct work_struct srs_cleanup_work;
 };
 
 /* Values for rcu_state structure's gp_flags field. */