lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20161126231350.10321-9-bigeasy@linutronix.de>
Date:   Sun, 27 Nov 2016 00:13:36 +0100
From:   Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To:     linux-kernel@...r.kernel.org
Cc:     rt@...utronix.de, tglx@...utronix.de,
        Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Vlastimil Babka <vbabka@...e.cz>,
        Mel Gorman <mgorman@...hsingularity.net>,
        Johannes Weiner <hannes@...xchg.org>, linux-mm@...ck.org
Subject: [PATCH 08/22] mm/vmstat: Avoid on each online CPU loops

Both iterations over online cpus can be replaced by the proper node
specific functions.

Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Vlastimil Babka <vbabka@...e.cz>
Cc: Mel Gorman <mgorman@...hsingularity.net>
Cc: Johannes Weiner <hannes@...xchg.org>
Cc: linux-mm@...ck.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
---
 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)
 
 static void __init init_cpu_node_state(void)
 {
-	int cpu;
+	int node;
 
-	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);
 }
 
 static void vmstat_cpu_dead(int node)
 {
-	int cpu;
+	const struct cpumask *node_cpus;
 
-	for_each_online_cpu(cpu)
-		if (cpu_to_node(cpu) == node)
-			return;
+	node_cpus = cpumask_of_node(node);
+	if (cpumask_weight(node_cpus) > 0)
+		return;
 
 	node_clear_state(node, N_CPU);
 }
-- 
2.10.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ