]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
srcu: Move rcu_init_levelspread() to rcu_tree_node.h
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 14 Mar 2017 21:29:53 +0000 (14:29 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 18 Apr 2017 18:38:20 +0000 (11:38 -0700)
This commit moves the rcu_init_levelspread() function from
kernel/rcu/tree.c to kernel/rcu/rcu.h so that SRCU can access it.  This is
another step towards enabling SRCU to create its own combining tree.
This commit is code-movement only, give or take knock-on adjustments.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
include/linux/rcu_node_tree.h
kernel/rcu/rcu.h
kernel/rcu/srcu.c
kernel/rcu/tree.c
kernel/rcu/tree_trace.c

index b7eb97096b1c29abf2953bc5419850db2486cccf..4b766b61e1a026c226bb86186a72009b8074929f 100644 (file)
@@ -96,7 +96,4 @@
 # error "CONFIG_RCU_FANOUT insufficient for NR_CPUS"
 #endif /* #if (NR_CPUS) <= RCU_FANOUT_1 */
 
-extern int rcu_num_lvls;
-extern int rcu_num_nodes;
-
 #endif /* __LINUX_RCU_NODE_TREE_H */
index a943b42a9cf796f60e94ae59dbf2070ddd0210d7..87326479b39ac19102ccd04bc31c0b6828cf121b 100644 (file)
@@ -190,4 +190,40 @@ void rcu_test_sync_prims(void);
  */
 extern void resched_cpu(int cpu);
 
+#if defined(SRCU) || !defined(TINY_RCU)
+
+#include <linux/rcu_node_tree.h>
+
+extern int rcu_num_lvls;
+extern int rcu_num_nodes;
+static bool rcu_fanout_exact;
+static int rcu_fanout_leaf;
+
+/*
+ * Compute the per-level fanout, either using the exact fanout specified
+ * or balancing the tree, depending on the rcu_fanout_exact boot parameter.
+ */
+static inline void rcu_init_levelspread(int *levelspread, const int *levelcnt)
+{
+       int i;
+
+       if (rcu_fanout_exact) {
+               levelspread[rcu_num_lvls - 1] = rcu_fanout_leaf;
+               for (i = rcu_num_lvls - 2; i >= 0; i--)
+                       levelspread[i] = RCU_FANOUT;
+       } else {
+               int ccur;
+               int cprv;
+
+               cprv = nr_cpu_ids;
+               for (i = rcu_num_lvls - 1; i >= 0; i--) {
+                       ccur = levelcnt[i];
+                       levelspread[i] = (cprv + ccur - 1) / ccur;
+                       cprv = ccur;
+               }
+       }
+}
+
+#endif /* #if defined(SRCU) || !defined(TINY_RCU) */
+
 #endif /* __LINUX_RCU_H */
index 56fd30862122557bcea5f72d627e8399853b47c5..0b511de7ca4d5aeb59b307202780acb465ee7ddd 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/delay.h>
 #include <linux/srcu.h>
 
+#include <linux/rcu_node_tree.h>
 #include "rcu.h"
 
 static int init_srcu_struct_fields(struct srcu_struct *sp)
index 844a030c196073add66ff06c3c32a782b1912628..df3527744af8ccde94ca529d2a6e4513a3a9f8fc 100644 (file)
@@ -3951,31 +3951,6 @@ void rcu_scheduler_starting(void)
        rcu_test_sync_prims();
 }
 
-/*
- * Compute the per-level fanout, either using the exact fanout specified
- * or balancing the tree, depending on the rcu_fanout_exact boot parameter.
- */
-static void __init rcu_init_levelspread(int *levelspread, const int *levelcnt)
-{
-       int i;
-
-       if (rcu_fanout_exact) {
-               levelspread[rcu_num_lvls - 1] = rcu_fanout_leaf;
-               for (i = rcu_num_lvls - 2; i >= 0; i--)
-                       levelspread[i] = RCU_FANOUT;
-       } else {
-               int ccur;
-               int cprv;
-
-               cprv = nr_cpu_ids;
-               for (i = rcu_num_lvls - 1; i >= 0; i--) {
-                       ccur = levelcnt[i];
-                       levelspread[i] = (cprv + ccur - 1) / ccur;
-                       cprv = ccur;
-               }
-       }
-}
-
 /*
  * Helper function for rcu_init() that initializes one rcu_state structure.
  */
index 066c64071a7b590db1d75554cb3bc063a2a8610c..30c5bf89ee58f4b016ad09b63ff9097541055153 100644 (file)
@@ -45,6 +45,7 @@
 
 #define RCU_TREE_NONCORE
 #include "tree.h"
+#include "rcu.h"
 
 static int r_open(struct inode *inode, struct file *file,
                                        const struct seq_operations *op)