Commit 0c34029abdfdea64420cb4264c4e91a776b22157
Committed by
Paul E. McKenney
1 parent
f261414f0d
rcu: move some code from macro to function
Shrink the RCU_INIT_FLAVOR() macro by moving all but the initialization of the ->rda[] array to rcu_init_one(). The call to rcu_init_one() can then be moved to the end of the RCU_INIT_FLAVOR() macro, which is required because rcu_boot_init_percpu_data(), which is now called from rcu_init_one(), depends on the initialization of the ->rda[] array. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Showing 1 changed file with 9 additions and 9 deletions Side-by-side Diff
kernel/rcutree.c
... | ... | @@ -1859,6 +1859,14 @@ |
1859 | 1859 | INIT_LIST_HEAD(&rnp->blocked_tasks[3]); |
1860 | 1860 | } |
1861 | 1861 | } |
1862 | + | |
1863 | + rnp = rsp->level[NUM_RCU_LVLS - 1]; | |
1864 | + for_each_possible_cpu(i) { | |
1865 | + if (i > rnp->grphi) | |
1866 | + rnp++; | |
1867 | + rsp->rda[i]->mynode = rnp; | |
1868 | + rcu_boot_init_percpu_data(i, rsp); | |
1869 | + } | |
1862 | 1870 | } |
1863 | 1871 | |
1864 | 1872 | /* |
1865 | 1873 | |
1866 | 1874 | |
1867 | 1875 | |
1868 | 1876 | |
... | ... | @@ -1869,19 +1877,11 @@ |
1869 | 1877 | #define RCU_INIT_FLAVOR(rsp, rcu_data) \ |
1870 | 1878 | do { \ |
1871 | 1879 | int i; \ |
1872 | - int j; \ | |
1873 | - struct rcu_node *rnp; \ | |
1874 | 1880 | \ |
1875 | - rcu_init_one(rsp); \ | |
1876 | - rnp = (rsp)->level[NUM_RCU_LVLS - 1]; \ | |
1877 | - j = 0; \ | |
1878 | 1881 | for_each_possible_cpu(i) { \ |
1879 | - if (i > rnp[j].grphi) \ | |
1880 | - j++; \ | |
1881 | - per_cpu(rcu_data, i).mynode = &rnp[j]; \ | |
1882 | 1882 | (rsp)->rda[i] = &per_cpu(rcu_data, i); \ |
1883 | - rcu_boot_init_percpu_data(i, rsp); \ | |
1884 | 1883 | } \ |
1884 | + rcu_init_one(rsp); \ | |
1885 | 1885 | } while (0) |
1886 | 1886 | |
1887 | 1887 | void __init rcu_init(void) |