summaryrefslogtreecommitdiffstats
path: root/kernel/rcu/rcu.h
diff options
context:
space:
mode:
authorPaul E. McKenney2018-04-24 20:03:39 +0200
committerPaul E. McKenney2018-06-25 20:25:41 +0200
commit5257514d8885b2ebc11bf359ea1527282b47a5fd (patch)
tree7c39cb001d70f457cf4873ce2b00cec9001e0bdf /kernel/rcu/rcu.h
parentLinux 4.18-rc1 (diff)
downloadkernel-qcow2-linux-5257514d8885b2ebc11bf359ea1527282b47a5fd.tar.gz
kernel-qcow2-linux-5257514d8885b2ebc11bf359ea1527282b47a5fd.tar.xz
kernel-qcow2-linux-5257514d8885b2ebc11bf359ea1527282b47a5fd.zip
rcu: Make expedited grace period use direct call on last leaf
During expedited grace-period initialization, a work item is scheduled for each leaf rcu_node structure. However, that initialization code is itself (normally) executing from a workqueue, so one of the leaf rcu_node structures could just as well be handled by that pre-existing workqueue, and with less overhead. This commit therefore uses a shiny new rcu_is_leaf_node() macro to execute the last leaf rcu_node structure's initialization directly from the pre-existing workqueue. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/rcu/rcu.h')
-rw-r--r--kernel/rcu/rcu.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h
index 40cea6735c2d..db0870acfdff 100644
--- a/kernel/rcu/rcu.h
+++ b/kernel/rcu/rcu.h
@@ -276,6 +276,9 @@ static inline void rcu_init_levelspread(int *levelspread, const int *levelcnt)
/* Is this rcu_node a leaf? */
#define rcu_is_leaf_node(rnp) ((rnp)->level == rcu_num_lvls - 1)
+/* Is this rcu_node the last leaf? */
+#define rcu_is_last_leaf_node(rsp, rnp) ((rnp) == &(rsp)->node[rcu_num_nodes - 1])
+
/*
* Do a full breadth-first scan of the rcu_node structures for the
* specified rcu_state structure.