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: <tip-4c501327b4c67f2b874219f20c41d2619b49c78c@git.kernel.org>
Date:   Thu, 1 Dec 2016 16:11:28 -0800
From:   tip-bot for Sebastian Andrzej Siewior <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     vbabka@...e.cz, linux-kernel@...r.kernel.org, hannes@...xchg.org,
        mgorman@...hsingularity.net, mhocko@...e.com, tglx@...utronix.de,
        mingo@...nel.org, hpa@...or.com, akpm@...ux-foundation.org,
        bigeasy@...utronix.de
Subject: [tip:smp/hotplug] mm/vmstat: Avoid on each online CPU loops

Commit-ID:  4c501327b4c67f2b874219f20c41d2619b49c78c
Gitweb:     http://git.kernel.org/tip/4c501327b4c67f2b874219f20c41d2619b49c78c
Author:     Sebastian Andrzej Siewior <bigeasy@...utronix.de>
AuthorDate: Tue, 29 Nov 2016 15:51:14 +0100
Committer:  Thomas Gleixner <tglx@...utronix.de>
CommitDate: Fri, 2 Dec 2016 00:52:35 +0100

mm/vmstat: Avoid on each online CPU loops

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

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Acked-by: Michal Hocko <mhocko@...e.com>
Cc: linux-mm@...ck.org
Cc: rt@...utronix.de
Cc: Johannes Weiner <hannes@...xchg.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Mel Gorman <mgorman@...hsingularity.net>
Cc: Vlastimil Babka <vbabka@...e.cz>
Link: http://lkml.kernel.org/r/20161129145113.fn3lw5aazjjvdrr3@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>

---
 mm/vmstat.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/mm/vmstat.c b/mm/vmstat.c
index 0b63ffb..5152cd1 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1720,19 +1720,21 @@ 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) {
+		if (cpumask_weight(cpumask_of_node(node)) > 0)
+			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);
 }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ