mirror of
https://github.com/torvalds/linux.git
synced 2024-12-12 14:12:51 +00:00
perf parse-events: Pass ownership of the group name
Pass ownership of the group name rather than copying and freeing the original. This saves a memory allocation and copy. Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Florian Fischer <florian.fischer@muhq.space> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@arm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Garry <john.g.garry@oracle.com> Cc: Kajol Jain <kjain@linux.ibm.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Kim Phillips <kim.phillips@amd.com> Cc: Leo Yan <leo.yan@linaro.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ravi Bangoria <ravi.bangoria@amd.com> Cc: Sean Christopherson <seanjc@google.com> Cc: Steinar H. Gunderson <sesse@google.com> Cc: Stephane Eranian <eranian@google.com> Cc: Suzuki Poulouse <suzuki.poulose@arm.com> Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com> Link: https://lore.kernel.org/r/20230312021543.3060328-2-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
7abf0bccaa
commit
4bb311b29e
@ -1761,6 +1761,7 @@ parse_events__set_leader_for_uncore_aliase(char *name, struct list_head *list,
|
||||
|
||||
handled:
|
||||
ret = 1;
|
||||
free(name);
|
||||
out:
|
||||
free(leaders);
|
||||
return ret;
|
||||
@ -1786,7 +1787,7 @@ void parse_events__set_leader(char *name, struct list_head *list,
|
||||
|
||||
leader = arch_evlist__leader(list);
|
||||
__perf_evlist__set_leader(list, &leader->core);
|
||||
leader->group_name = name ? strdup(name) : NULL;
|
||||
leader->group_name = name;
|
||||
list_move(&leader->core.node, list);
|
||||
}
|
||||
|
||||
|
@ -202,8 +202,8 @@ PE_NAME '{' events '}'
|
||||
struct list_head *list = $3;
|
||||
|
||||
inc_group_count(list, _parse_state);
|
||||
/* Takes ownership of $1. */
|
||||
parse_events__set_leader($1, list, _parse_state);
|
||||
free($1);
|
||||
$$ = list;
|
||||
}
|
||||
|
|
||||
|
Loading…
Reference in New Issue
Block a user