2021-07-15 19:55:00

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH 02/20] perf env: fix sibling_dies memory leak

Em Thu, Jul 15, 2021 at 06:07:07PM +0200, Riccardo Mancini escreveu:
> ASan reports a memory leak in perf_env while running the perf test
> "41: Session topology", caused by sibling_dies not being freed.
>
> This patch adds the required free.

> Fixes: acae8b36cded0ee6 ("perf header: Add die information in CPU topology")

So, I CC the author of the patch and its committer, using this shell
script:

$ cat ~/bin/fixes
#!/bin/bash

cset=$1
if [ $# -eq 0 ] ; then
read cset
fi
git show --pretty=fuller $cset | grep '^\(Author\|Commit\): ' | sed -r 's/.*: +/Cc: /g' | grep -v "Arnaldo Carvalho de Melo" | sort -u
echo Fixes: `git one $cset`
$
$ grep one -B1 ~/.gitconfig
[alias]
one = show -s --pretty='format:%h (\"%s\")'
$
$ fixes acae8b36cded0ee6
Cc: Kan Liang <[email protected]>
Fixes: acae8b36cded0ee6 ("perf header: Add die information in CPU topology")
$

Normally I copy the cset SHA and, in vim, select it and run !fixes, i.e.

:'<,'>!fixes

Thanks, applied.

- Arnaldo

> Signed-off-by: Riccardo Mancini <[email protected]>
> ---
> tools/perf/util/env.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c
> index ebc5e9ad35db21d1..6c765946ef6f591c 100644
> --- a/tools/perf/util/env.c
> +++ b/tools/perf/util/env.c
> @@ -186,6 +186,7 @@ void perf_env__exit(struct perf_env *env)
> zfree(&env->cpuid);
> zfree(&env->cmdline);
> zfree(&env->cmdline_argv);
> + zfree(&env->sibling_dies);
> zfree(&env->sibling_cores);
> zfree(&env->sibling_threads);
> zfree(&env->pmu_mappings);
> --
> 2.31.1
>

--

- Arnaldo


2021-07-16 13:14:45

by Riccardo Mancini

[permalink] [raw]
Subject: Re: [PATCH 02/20] perf env: fix sibling_dies memory leak

Hi Arnaldo,

thanks for reviewing this patchset and, more importantly, for manually adding
all Fixes: tags. I'm so sorry for that.

On Thu, 2021-07-15 at 16:49 -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Jul 15, 2021 at 06:07:07PM +0200, Riccardo Mancini escreveu:
> > ASan reports a memory leak in perf_env while running the perf test
> > "41: Session topology", caused by sibling_dies not being freed.
> >
> > This patch adds the required free.
>  
> > Fixes: acae8b36cded0ee6 ("perf header: Add die information in CPU topology")
>
> So, I CC the author of the patch and its committer, using this shell
> script:
>
>   $ cat ~/bin/fixes
>   #!/bin/bash
>  
>   cset=$1
>   if [ $# -eq 0 ] ; then
>         read cset
>   fi
>   git show --pretty=fuller $cset | grep '^\(Author\|Commit\): ' | sed -r
> 's/.*: +/Cc: /g' | grep -v "Arnaldo Carvalho de Melo" | sort -u
>   echo Fixes: `git one $cset`
>   $
>   $ grep one -B1 ~/.gitconfig
>   [alias]
>         one = show -s --pretty='format:%h (\"%s\")'
>   $
>   $ fixes acae8b36cded0ee6
>   Cc: Kan Liang <[email protected]>
>   Fixes: acae8b36cded0ee6 ("perf header: Add die information in CPU topology")
>   $
>
> Normally I copy the cset SHA and, in vim, select it and run !fixes, i.e.
>
> :'<,'>!fixes

Thanks! I've added this nice script to my PATH. :)

Thanks,
Riccardo

>
> Thanks, applied.
>
> - Arnaldo
>
> > Signed-off-by: Riccardo Mancini <[email protected]>
> > ---
> >  tools/perf/util/env.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c
> > index ebc5e9ad35db21d1..6c765946ef6f591c 100644
> > --- a/tools/perf/util/env.c
> > +++ b/tools/perf/util/env.c
> > @@ -186,6 +186,7 @@ void perf_env__exit(struct perf_env *env)
> >         zfree(&env->cpuid);
> >         zfree(&env->cmdline);
> >         zfree(&env->cmdline_argv);
> > +       zfree(&env->sibling_dies);
> >         zfree(&env->sibling_cores);
> >         zfree(&env->sibling_threads);
> >         zfree(&env->pmu_mappings);
> > --
> > 2.31.1
> >
>