[PATCH 02/10] perf: Move build_id_parse to check only regular files
From: Jiri Olsa
Date: Tue Jun 22 2021 - 11:39:40 EST
Moving the build_id_parse function to place where it
parses only regular files.
There's no change wrt maps we generate the build id for,
because we get parsed build ids for only for regular
files (non-special files) anyway.
Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
---
kernel/events/core.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index d83ccb58a3c1..3f1630c06195 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -8336,6 +8336,12 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event)
maj = MAJOR(dev);
min = MINOR(dev);
+ if (atomic_read(&nr_build_id_events) && *name == '/') {
+ int err = build_id_parse(vma, mmap_event->build_id,
+ &mmap_event->build_id_size);
+ mmap_event->build_id_fault = err == -EFAULT;
+ }
+
goto got_name;
} else {
if (vma->vm_ops && vma->vm_ops->name) {
@@ -8390,12 +8396,6 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event)
mmap_event->event_id.header.size = sizeof(mmap_event->event_id) + size;
- if (atomic_read(&nr_build_id_events)) {
- int err = build_id_parse(vma, mmap_event->build_id,
- &mmap_event->build_id_size);
- mmap_event->build_id_fault = err == -EFAULT;
- }
-
perf_iterate_sb(perf_event_mmap_output,
mmap_event,
NULL);
--
2.31.1