Re: [PATCH tip/core/rcu 12/23] rcu: Prevent force_quiescent_state()memory contention

From: Josh Triplett
Date: Sun Sep 02 2012 - 06:47:50 EST


On Thu, Aug 30, 2012 at 11:18:27AM -0700, Paul E. McKenney wrote:
> --- a/kernel/rcutree.c
> +++ b/kernel/rcutree.c
[...]
> @@ -1824,16 +1825,35 @@ static void force_qs_rnp(struct rcu_state *rsp, int (*f)(struct rcu_data *))
> static void force_quiescent_state(struct rcu_state *rsp)
> {
> unsigned long flags;
> - struct rcu_node *rnp = rcu_get_root(rsp);
> + bool ret;
> + struct rcu_node *rnp;
> + struct rcu_node *rnp_old = NULL;
> +
> + /* Funnel through hierarchy to reduce memory contention. */
> + rnp = per_cpu_ptr(rsp->rda, raw_smp_processor_id())->mynode;

What makes this use of raw_smp_processor_id() safe? (And, could you
document the answer here?)

> + for (; rnp != NULL; rnp = rnp->parent) {
> + ret = (ACCESS_ONCE(rsp->gp_flags) & RCU_GP_FLAG_FQS) ||
> + !raw_spin_trylock(&rnp->fqslock);

So, the root lock will still get trylocked by one CPU per second-level
tree node, just not by every CPU?

> @@ -2721,10 +2741,14 @@ static void __init rcu_init_levelspread(struct rcu_state *rsp)
> static void __init rcu_init_one(struct rcu_state *rsp,
> struct rcu_data __percpu *rda)
> {
> - static char *buf[] = { "rcu_node_level_0",
> - "rcu_node_level_1",
> - "rcu_node_level_2",
> - "rcu_node_level_3" }; /* Match MAX_RCU_LVLS */
> + static char *buf[] = { "rcu_node_0",
> + "rcu_node_1",
> + "rcu_node_2",
> + "rcu_node_3" }; /* Match MAX_RCU_LVLS */

Why rename these?

- Josh Triplett
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/