[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191014084811.GA9700@krava>
Date: Mon, 14 Oct 2019 10:48:11 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Andi Kleen <ak@...ux.intel.com>
Cc: Jiri Olsa <jolsa@...nel.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
lkml <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Michael Petlan <mpetlan@...hat.com>
Subject: Re: [PATCH 3/3] perf tools: Make 'struct map_shared' truly shared
On Sun, Oct 13, 2019 at 08:10:54PM -0700, Andi Kleen wrote:
> On Sun, Oct 13, 2019 at 05:14:27PM +0200, Jiri Olsa wrote:
> > Andi reported that maps cloning is eating lot of memory and
> > it's probably unnecessary, because they keep the same data.
> >
> > Changing 'struct map_shared' to be a pointer inside 'struct map',
> > so it can be shared on fork. Changing the map__clone function to
> > actually share 'struct map_shared' for cloned maps.
> >
> > The 'struct map_shared' carries its own refcnt counter, which is
> > incremented when it's assigned to new 'struct map' and decremented
> > when 'struct map' gets deleted in map__delete (its refcnt is 0).
> >
> > This 'maps sharing' seems to save lot of heap for reports with
> > many forks/cloned mmaps (over 60% in example below).
>
> The one case I wasn't sure about is with JIT support. So if
> a map gets modified with fixup/start from /tmp/perf-%d
> in one process, would it impact the other too?
there are cases we do the fixup for maps and we clone
the map fully in those cases, but not sure now what JIT
does.. I'll check the JIT path
thanks,
jirka
>
> We may need a COW operation for this (hopefully rare) case.
>
> -Andi
Powered by blists - more mailing lists