Re: [PATCH 1/3] perf header: Add die information in CPU topology
From: Jiri Olsa
Date: Tue May 28 2019 - 05:03:10 EST
On Thu, May 23, 2019 at 01:41:19PM -0700, kan.liang@xxxxxxxxxxxxxxx wrote:
SNIP
> @@ -88,7 +138,7 @@ static int build_cpu_topology(struct cpu_topology *tp, int cpu)
> return ret;
> }
>
> -void cpu_topology__delete(struct cpu_topology *tp)
> +void cpu_topology__delete(struct cpu_topology *tp, bool has_die)
> {
> u32 i;
>
> @@ -98,17 +148,22 @@ void cpu_topology__delete(struct cpu_topology *tp)
> for (i = 0 ; i < tp->core_sib; i++)
> zfree(&tp->core_siblings[i]);
>
> + if (has_die) {
I think there's no need for has_die check in here,
tp->die_sib will be zero, and also will tp->die_siblings[i]
jirka
> + for (i = 0 ; i < tp->die_sib; i++)
> + zfree(&tp->die_siblings[i]);
> + }
> +
> for (i = 0 ; i < tp->thread_sib; i++)
> zfree(&tp->thread_siblings[i]);
>
> free(tp);
> }
SNIP