perf machine: Move kernel mmap name into struct machine
It simplifies and centralizes the code. The kernel mmap name is set for machine type, which we know from the beginning, so there's no reason to generate it every time we need it. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20180215122635.24029-5-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
81f981d7ec
commit
8c7f1bb37b
@@ -316,7 +316,6 @@ static int machine__write_buildid_table(struct machine *machine,
|
||||
struct feat_fd *fd)
|
||||
{
|
||||
int err = 0;
|
||||
char nm[PATH_MAX];
|
||||
struct dso *pos;
|
||||
u16 kmisc = PERF_RECORD_MISC_KERNEL,
|
||||
umisc = PERF_RECORD_MISC_USER;
|
||||
@@ -338,9 +337,8 @@ static int machine__write_buildid_table(struct machine *machine,
|
||||
name = pos->short_name;
|
||||
name_len = pos->short_name_len;
|
||||
} else if (dso__is_kcore(pos)) {
|
||||
machine__mmap_name(machine, nm, sizeof(nm));
|
||||
name = nm;
|
||||
name_len = strlen(nm);
|
||||
name = machine->mmap_name;
|
||||
name_len = strlen(name);
|
||||
} else {
|
||||
name = pos->long_name;
|
||||
name_len = pos->long_name_len;
|
||||
@@ -813,12 +811,10 @@ static int dso__cache_build_id(struct dso *dso, struct machine *machine)
|
||||
bool is_kallsyms = dso__is_kallsyms(dso);
|
||||
bool is_vdso = dso__is_vdso(dso);
|
||||
const char *name = dso->long_name;
|
||||
char nm[PATH_MAX];
|
||||
|
||||
if (dso__is_kcore(dso)) {
|
||||
is_kallsyms = true;
|
||||
machine__mmap_name(machine, nm, sizeof(nm));
|
||||
name = nm;
|
||||
name = machine->mmap_name;
|
||||
}
|
||||
return build_id_cache__add_b(dso->build_id, sizeof(dso->build_id), name,
|
||||
dso->nsinfo, is_kallsyms, is_vdso);
|
||||
|
Reference in New Issue
Block a user