aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2013-10-16 16:09:45 -0400
committerIngo Molnar <mingo@kernel.org>2013-10-29 07:02:51 -0400
commit32c5fb7e7d18b4fd37c5e29dea731151e9d66866 (patch)
tree1e61c95eb304fd493684138baf791517aa7dfed5
parentd9494cb4299da66541a3f3ab82c552889bee0606 (diff)
perf: Kill the dead !vma->vm_mm code in perf_event_mmap_event()
1. perf_event_mmap(vma) is never called with a gate_vma-like arg, remove the "if (!vma->vm_mm)" code. 2. arch_vma_name() can use the chached value of mmap_event->vma. 3. Change the code to not call arch_vma_name() twice. 4. Purely cosmetic, but since we use "goto got_name" all the time remove "else" from "[stack]" branch just for symmetry. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20131016200945.GB23214@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--kernel/events/core.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 028dad97760d..3ea560551a2a 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -5136,21 +5136,19 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event)
5136 min = MINOR(dev); 5136 min = MINOR(dev);
5137 5137
5138 } else { 5138 } else {
5139 if (arch_vma_name(mmap_event->vma)) { 5139 name = arch_vma_name(vma);
5140 name = strncpy(tmp, arch_vma_name(mmap_event->vma), 5140 if (name) {
5141 sizeof(tmp) - 1); 5141 name = strncpy(tmp, name, sizeof(tmp) - 1);
5142 tmp[sizeof(tmp) - 1] = '\0'; 5142 tmp[sizeof(tmp) - 1] = '\0';
5143 goto got_name; 5143 goto got_name;
5144 } 5144 }
5145 5145
5146 if (!vma->vm_mm) { 5146 if (vma->vm_start <= vma->vm_mm->start_brk &&
5147 name = strncpy(tmp, "[vdso]", sizeof(tmp));
5148 goto got_name;
5149 } else if (vma->vm_start <= vma->vm_mm->start_brk &&
5150 vma->vm_end >= vma->vm_mm->brk) { 5147 vma->vm_end >= vma->vm_mm->brk) {
5151 name = strncpy(tmp, "[heap]", sizeof(tmp)); 5148 name = strncpy(tmp, "[heap]", sizeof(tmp));
5152 goto got_name; 5149 goto got_name;
5153 } else if (vma->vm_start <= vma->vm_mm->start_stack && 5150 }
5151 if (vma->vm_start <= vma->vm_mm->start_stack &&
5154 vma->vm_end >= vma->vm_mm->start_stack) { 5152 vma->vm_end >= vma->vm_mm->start_stack) {
5155 name = strncpy(tmp, "[stack]", sizeof(tmp)); 5153 name = strncpy(tmp, "[stack]", sizeof(tmp));
5156 goto got_name; 5154 goto got_name;