Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1532364
| From | Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 08/22 v2] mm/vmstat: Avoid on each online CPU loops |
| Date | 2016-11-29 16:00 +0100 |
| Message-ID | <sIS30-1lb-19@gated-at.bofh.it> (permalink) |
| References | <sHUqd-4EY-3@gated-at.bofh.it> <sHUqe-4EY-27@gated-at.bofh.it> <sIqq6-f5-23@gated-at.bofh.it> <sIRqh-17H-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Both iterations over online cpus can be replaced by the proper node
specific functions.
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: linux-mm@kvack.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
v1…v2: take into account that we may have online nodes with no CPUs.
mm/vmstat.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 0b63ffb5c407..5152cd1c490f 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);
}
--
2.10.2
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 08/22] mm/vmstat: Avoid on each online CPU loops Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-27 00:20 +0100
Re: [PATCH 08/22] mm/vmstat: Avoid on each online CPU loops Michal Hocko <mhocko@kernel.org> - 2016-11-28 10:30 +0100
Re: [PATCH 08/22] mm/vmstat: Avoid on each online CPU loops Thomas Gleixner <tglx@linutronix.de> - 2016-11-29 15:20 +0100
Re: [PATCH 08/22] mm/vmstat: Avoid on each online CPU loops Michal Hocko <mhocko@kernel.org> - 2016-11-29 15:50 +0100
[PATCH 08/22 v2] mm/vmstat: Avoid on each online CPU loops Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-29 16:00 +0100
Re: [PATCH 08/22 v2] mm/vmstat: Avoid on each online CPU loops Michal Hocko <mhocko@kernel.org> - 2016-11-29 16:30 +0100
[tip:smp/hotplug] mm/vmstat: Avoid on each online CPU loops tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-12-02 01:20 +0100
csiph-web