From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753518AbcKZXSX (ORCPT ); Sat, 26 Nov 2016 18:18:23 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:43486 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753190AbcKZXOW (ORCPT ); Sat, 26 Nov 2016 18:14:22 -0500 From: Sebastian Andrzej Siewior To: linux-kernel@vger.kernel.org Cc: rt@linutronix.de, tglx@linutronix.de, Sebastian Andrzej Siewior , Andrew Morton , Vlastimil Babka , Mel Gorman , Johannes Weiner , linux-mm@kvack.org Subject: [PATCH 08/22] mm/vmstat: Avoid on each online CPU loops Date: Sun, 27 Nov 2016 00:13:36 +0100 Message-Id: <20161126231350.10321-9-bigeasy@linutronix.de> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161126231350.10321-1-bigeasy@linutronix.de> References: <20161126231350.10321-1-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Both iterations over online cpus can be replaced by the proper node specific functions. Cc: Andrew Morton Cc: Vlastimil Babka Cc: Mel Gorman Cc: Johannes Weiner Cc: linux-mm@kvack.org Signed-off-by: Sebastian Andrzej Siewior --- mm/vmstat.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/vmstat.c b/mm/vmstat.c index 0b63ffb5c407..b96dcec7e7d7 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1720,19 +1720,19 @@ static void __init start_shepherd_timer(void) =20 static void __init init_cpu_node_state(void) { - int cpu; + int node; =20 - for_each_online_cpu(cpu) - node_set_state(cpu_to_node(cpu), N_CPU); + for_each_online_node(node) + node_set_state(node, N_CPU); } =20 static void vmstat_cpu_dead(int node) { - int cpu; + const struct cpumask *node_cpus; =20 - for_each_online_cpu(cpu) - if (cpu_to_node(cpu) =3D=3D node) - return; + node_cpus =3D cpumask_of_node(node); + if (cpumask_weight(node_cpus) > 0) + return; =20 node_clear_state(node, N_CPU); } --=20 2.10.2