From: Oleg Nesterov <oleg@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] perf: Kill the dead !vma->vm_mm code in perf_event_mmap_event()
Date: Wed, 16 Oct 2013 22:09:45 +0200 [thread overview]
Message-ID: <20131016200945.GB23214@redhat.com> (raw)
In-Reply-To: <20131016200924.GA23214@redhat.com>
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>
---
kernel/events/core.c | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index cb4238e..e27d8f8 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -5130,21 +5130,19 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event)
min = MINOR(dev);
} else {
- if (arch_vma_name(mmap_event->vma)) {
- name = strncpy(tmp, arch_vma_name(mmap_event->vma),
- sizeof(tmp) - 1);
+ name = arch_vma_name(vma);
+ if (name) {
+ name = strncpy(tmp, name, sizeof(tmp) - 1);
tmp[sizeof(tmp) - 1] = '\0';
goto got_name;
}
- if (!vma->vm_mm) {
- name = strncpy(tmp, "[vdso]", sizeof(tmp));
- goto got_name;
- } else if (vma->vm_start <= vma->vm_mm->start_brk &&
+ if (vma->vm_start <= vma->vm_mm->start_brk &&
vma->vm_end >= vma->vm_mm->brk) {
name = strncpy(tmp, "[heap]", sizeof(tmp));
goto got_name;
- } else if (vma->vm_start <= vma->vm_mm->start_stack &&
+ }
+ if (vma->vm_start <= vma->vm_mm->start_stack &&
vma->vm_end >= vma->vm_mm->start_stack) {
name = strncpy(tmp, "[stack]", sizeof(tmp));
goto got_name;
--
1.5.5.1
next prev parent reply other threads:[~2013-10-16 20:16 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-12 19:22 perf_event_mmap(vma) && !vma->vm_mm Oleg Nesterov
2013-10-14 10:24 ` Peter Zijlstra
2013-10-16 20:09 ` [PATCH 0/2] (Was: perf_event_mmap(vma) && !vma->vm_mm) Oleg Nesterov
2013-10-16 20:09 ` Oleg Nesterov [this message]
2013-10-29 14:08 ` [tip:perf/core] perf: Kill the dead !vma-> vm_mm code in perf_event_mmap_event() tip-bot for Oleg Nesterov
2013-10-16 20:10 ` [PATCH 2/2] perf: Do not waste PAGE_SIZE bytes for ALIGN(8) " Oleg Nesterov
2013-10-29 14:08 ` [tip:perf/core] " tip-bot for Oleg Nesterov
2013-10-16 20:28 ` [PATCH 0/2] (Was: perf_event_mmap(vma) && !vma->vm_mm) Peter Zijlstra
2013-10-16 20:43 ` Oleg Nesterov
2013-10-16 20:55 ` Peter Zijlstra
2013-10-16 20:55 ` Oleg Nesterov
2013-10-16 20:58 ` Peter Zijlstra
2013-10-16 20:58 ` Oleg Nesterov
2013-10-16 21:16 ` Peter Zijlstra
2013-10-17 15:20 ` Oleg Nesterov
2013-10-17 15:27 ` Oleg Nesterov
2013-10-17 16:47 ` Peter Zijlstra
2013-10-17 18:24 ` Oleg Nesterov
2013-10-17 21:32 ` Peter Zijlstra
2013-11-06 13:19 ` [tip:perf/core] perf: Factor out strncpy() in perf_event_mmap_event() tip-bot for Oleg Nesterov
2013-10-17 16:38 ` [PATCH 0/2] (Was: perf_event_mmap(vma) && !vma->vm_mm) Peter Zijlstra
2013-10-17 15:22 ` [PATCH 3/2] perf: Optimize the fill/align code in perf_event_mmap_event() Oleg Nesterov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131016200945.GB23214@redhat.com \
--to=oleg@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox