[PATCH 5/5] perf/core: use vma_is_stack() and vma_is_heap()
From: Kefeng Wang
Date: Wed Jul 12 2023 - 10:25:31 EST
Use the helpers to simplify code, also kill unneeded goto cpy_name.
Signed-off-by: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx>
---
kernel/events/core.c | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 78ae7b6f90fd..cb271f449b81 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -8685,22 +8685,14 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event)
}
name = (char *)arch_vma_name(vma);
- if (name)
- goto cpy_name;
-
- if (vma->vm_start <= vma->vm_mm->start_brk &&
- vma->vm_end >= vma->vm_mm->brk) {
- name = "[heap]";
- goto cpy_name;
+ if (!name) {
+ if (vma_is_heap(vma))
+ name = "[heap]";
+ else if (vma_is_stack(vma))
+ name = "[stack]";
+ else
+ name = "//anon";
}
- if (vma->vm_start <= vma->vm_mm->start_stack &&
- vma->vm_end >= vma->vm_mm->start_stack) {
- name = "[stack]";
- goto cpy_name;
- }
-
- name = "//anon";
- goto cpy_name;
}
cpy_name:
--
2.41.0