summaryrefslogtreecommitdiff
path: root/mm/vmalloc.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2021-11-05 23:39:25 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2021-11-06 23:30:36 +0300
commit51e50b3a22937ab7b350f05af7e3b79b7ff73dd3 (patch)
tree26b01d42c19979bd8c22ca0e8546c1c9f38da694 /mm/vmalloc.c
parentbd1a8fb2d43f7c293383f76691d7a55f7f89d9da (diff)
downloadlinux-51e50b3a22937ab7b350f05af7e3b79b7ff73dd3.tar.xz
mm/vmalloc: make show_numa_info() aware of hugepage mappings
show_numa_info() can be slightly faster, by skipping over hugepages directly. Link: https://lkml.kernel.org/r/20211001172725.105824-1-eric.dumazet@gmail.com Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Uladzislau Rezki (Sony) <urezki@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r--mm/vmalloc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 4a11abd9e70f..6c1b97fd9b3d 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -3864,6 +3864,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;
@@ -3875,9 +3876,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]);