linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/vmalloc: make show_numa_info() aware of hugepage mappings
@ 2021-10-01 17:27 Eric Dumazet
  0 siblings, 0 replies; only message in thread
From: Eric Dumazet @ 2021-10-01 17:27 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, linux-mm, Eric Dumazet, Eric Dumazet

From: Eric Dumazet <edumazet@google.com>

show_numa_info() can be slightly faster, by skipping
over hugepages directly.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 mm/vmalloc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 42219f3d12b567fc64f54cd3e2f1e3398e261a2c..d51f5e1c95b4e01add8b952b6c5e2de2a1139e46 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -3853,6 +3853,7 @@ static void show_numa_info(struct seq_file *m, struct vm_struct *v)
 {
 	if (IS_ENABLED(CONFIG_NUMA)) {
 		unsigned int nr, *counters = m->private;
+		unsigned int step = 1U << vm_area_page_order(v);
 
 		if (!counters)
 			return;
@@ -3864,9 +3865,8 @@ static void show_numa_info(struct seq_file *m, struct vm_struct *v)
 
 		memset(counters, 0, nr_node_ids * sizeof(unsigned int));
 
-		for (nr = 0; nr < v->nr_pages; nr++)
-			counters[page_to_nid(v->pages[nr])]++;
-
+		for (nr = 0; nr < v->nr_pages; nr += step)
+			counters[page_to_nid(v->pages[nr])] += step;
 		for_each_node_state(nr, N_HIGH_MEMORY)
 			if (counters[nr])
 				seq_printf(m, " N%u=%u", nr, counters[nr]);
-- 
2.33.0.800.g4c38ced690-goog



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-01 17:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-01 17:27 [PATCH] mm/vmalloc: make show_numa_info() aware of hugepage mappings Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox