From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935119AbcLOCnu (ORCPT ); Wed, 14 Dec 2016 21:43:50 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:35855 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753338AbcLOCnZ (ORCPT ); Wed, 14 Dec 2016 21:43:25 -0500 From: Boqun Feng To: linux-kernel@vger.kernel.org Cc: "Paul E . McKenney " , Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Colin King , Mark Rutland , Boqun Feng Subject: [RFC v2 5/5] rcu: Use for_each_leaf_node_cpu() in online CPU iteration Date: Thu, 15 Dec 2016 10:42:04 +0800 Message-Id: <20161215024204.28620-6-boqun.feng@gmail.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161215024204.28620-1-boqun.feng@gmail.com> References: <20161215024204.28620-1-boqun.feng@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Though mostly identical, ->qsmaskinit(A.K.A rcu_rnp_online_cpus()) is sometimes more sparse than the corresponding part of cpu_possible_mask for an RCU leaf node. So we use for_each_leaf_node_cpu() in rcu_boost_kthread_setaffinity() instead to save some extra checks. Signed-off-by: Boqun Feng --- kernel/rcu/tree_plugin.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index 69c6eb27c37f..93cebd940a93 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h @@ -1175,10 +1175,11 @@ static void rcu_boost_kthread_setaffinity(struct rcu_node *rnp, int outgoingcpu) return; if (!zalloc_cpumask_var(&cm, GFP_KERNEL)) return; - for_each_leaf_node_possible_cpu(rnp, cpu) - if ((mask & leaf_node_cpu_bit(rnp, cpu)) && - cpu != outgoingcpu) + + for_each_leaf_node_cpu(rnp, mask, cpu) + if (cpu != outgoingcpu) cpumask_set_cpu(cpu, cm); + if (cpumask_weight(cm) == 0) cpumask_setall(cm); set_cpus_allowed_ptr(t, cm); -- 2.10.2