mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
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 <[email protected]> Acked-by: Michal Hocko <[email protected]> Cc: [email protected] Cc: [email protected] Cc: Johannes Weiner <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Vlastimil Babka <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Thomas Gleixner <[email protected]>
This commit is contained in:
parent
76f290935b
commit
4c501327b4
1 changed files with 9 additions and 7 deletions
16
mm/vmstat.c
16
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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue