From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932739AbcLIItt (ORCPT ); Fri, 9 Dec 2016 03:49:49 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:33287 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932495AbcLIItr (ORCPT ); Fri, 9 Dec 2016 03:49:47 -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 4/5] rcu: Use leaf_node_for_each_mask_possible_cpu() in force_qs_rnp() Date: Fri, 9 Dec 2016 16:48:26 +0800 Message-Id: <20161209084828.11827-5-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 ->qsmask of an RCU leaf node is usually more sparse than the corresponding cpu_possible_mask. So replace the for_each_leaf_node_possible_cpu() in force_qs_rnp() with leaf_node_for_each_mask_possible_cpu() to save several checks. Signed-off-by: Boqun Feng --- kernel/rcu/tree.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 5f6802b9ba5f..10162ac71dbe 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3014,6 +3014,7 @@ static void force_qs_rnp(struct rcu_state *rsp, bool *isidle, unsigned long *maxj) { int cpu; + unsigned long bit; unsigned long flags; unsigned long mask; struct rcu_node *rnp; @@ -3047,13 +3048,11 @@ static void force_qs_rnp(struct rcu_state *rsp, continue; } } - for_each_leaf_node_possible_cpu(rnp, cpu) { - unsigned long bit = leaf_node_cpu_bit(rnp, cpu); - if ((rnp->qsmask & bit) != 0) { - if (f(per_cpu_ptr(rsp->rda, cpu), isidle, maxj)) - mask |= bit; - } - } + + leaf_node_for_each_mask_possible_cpu(rnp, rnp->qsmask, bit, cpu) + if (f(per_cpu_ptr(rsp->rda, cpu), isidle, maxj)) + mask |= 1 << bit; + if (mask != 0) { /* Idle/offline CPUs, report (releases rnp->lock. */ rcu_report_qs_rnp(mask, rsp, rnp, rnp->gpnum, flags); -- 2.10.2