if (!perf_session__has_traces(session, "kmem record"))
goto out_delete;
- if (perf_session__create_kernel_maps(session) < 0) {
- pr_err("Problems creating kernel maps\n");
- return -1;
- }
-
setup_pager();
err = perf_session__process_events(session, &event_ops);
if (err != 0)
return -1;
}
- if (perf_session__create_kernel_maps(session) < 0) {
- pr_err("Problems creating kernel maps\n");
- return -1;
- }
-
if (!file_new) {
err = perf_header__read(&session->header, output);
if (err < 0)
if (session == NULL)
return -ENOMEM;
- if (perf_session__create_kernel_maps(session) < 0) {
- pr_err("Problems creating kernel maps\n");
- return -1;
- }
-
if (target_pid != -1)
event__synthesize_thread(target_pid, event__process, session);
else
self->unknown_events = 0;
map_groups__init(&self->kmaps);
- if (mode == O_RDONLY && perf_session__open(self, force) < 0)
- goto out_delete;
+ if (mode == O_RDONLY) {
+ if (perf_session__open(self, force) < 0)
+ goto out_delete;
+ } else if (mode == O_WRONLY) {
+ /*
+ * In O_RDONLY mode this will be performed when reading the
+ * kernel MMAP event, in event__process_mmap().
+ */
+ if (perf_session__create_kernel_maps(self) < 0)
+ goto out_delete;
+ }
self->sample_type = perf_header__sample_type(&self->header);
out: