From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932460AbcLIItd (ORCPT ); Fri, 9 Dec 2016 03:49:33 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:33020 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753857AbcLIItb (ORCPT ); Fri, 9 Dec 2016 03:49:31 -0500 From: Boqun Feng To: linux-kernel@vger.kernel.org Cc: "Paul E. McKenney" , Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Boqun Feng Subject: [RFC 2/5] rcu: Use leaf_node_for_each_mask_possible_cpu() in RCU stall checking Date: Fri, 9 Dec 2016 16:48:24 +0800 Message-Id: <20161209084828.11827-3-boqun.feng@gmail.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161209084828.11827-1-boqun.feng@gmail.com> References: <20161209084828.11827-1-boqun.feng@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace for_each_leaf_node_possible_cpu() loop with leaf_node_for_each_mask_possible_cpu() loop to gain fewer checks in RCU stall checking code. Signed-off-by: Boqun Feng --- kernel/rcu/tree.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index b56e2dc31ba5..5f6802b9ba5f 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -1412,15 +1412,16 @@ static void rcu_check_gp_kthread_starvation(struct rcu_state *rsp) static void rcu_dump_cpu_stacks(struct rcu_state *rsp) { int cpu; - unsigned long flags; + unsigned long flags, bit; struct rcu_node *rnp; rcu_for_each_leaf_node(rsp, rnp) { raw_spin_lock_irqsave_rcu_node(rnp, flags); - for_each_leaf_node_possible_cpu(rnp, cpu) - if (rnp->qsmask & leaf_node_cpu_bit(rnp, cpu)) - if (!trigger_single_cpu_backtrace(cpu)) - dump_cpu_task(cpu); + + leaf_node_for_each_mask_possible_cpu(rnp, rnp->qsmask, bit, cpu) + if (!trigger_single_cpu_backtrace(cpu)) + dump_cpu_task(cpu); + raw_spin_unlock_irqrestore_rcu_node(rnp, flags); } } @@ -1455,6 +1456,7 @@ static void print_other_cpu_stall(struct rcu_state *rsp, unsigned long gpnum) { int cpu; long delta; + unsigned long bit; unsigned long flags; unsigned long gpa; unsigned long j; @@ -1490,13 +1492,12 @@ static void print_other_cpu_stall(struct rcu_state *rsp, unsigned long gpnum) rcu_for_each_leaf_node(rsp, rnp) { raw_spin_lock_irqsave_rcu_node(rnp, flags); ndetected += rcu_print_task_stall(rnp); - if (rnp->qsmask != 0) { - for_each_leaf_node_possible_cpu(rnp, cpu) - if (rnp->qsmask & leaf_node_cpu_bit(rnp, cpu)) { - print_cpu_stall_info(rsp, cpu); - ndetected++; - } + + leaf_node_for_each_mask_possible_cpu(rnp, rnp->qsmask, bit, cpu) { + print_cpu_stall_info(rsp, cpu); + ndetected++; } + raw_spin_unlock_irqrestore_rcu_node(rnp, flags); } -- 2.10.2