Commit 4c501327 authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Thomas Gleixner
Browse files

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: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: default avatarMichal Hocko <mhocko@suse.com>
Cc: linux-mm@kvack.org
Cc: rt@linutronix.de
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Vlastimil Babka <vbabka@suse.cz>
Link: http://lkml.kernel.org/r/20161129145113.fn3lw5aazjjvdrr3@linutronix.de


Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 76f29093
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -1720,18 +1720,20 @@ 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)
	node_cpus = cpumask_of_node(node);
	if (cpumask_weight(node_cpus) > 0)
		return;

	node_clear_state(node, N_CPU);