[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9d7chU1Jyurb6bmZOSmeuFky9eN+2Ty7kMrQxyUXN=r0FKvg@mail.gmail.com>
Date: Sat, 2 Dec 2023 15:56:48 -0800
From: Namhyung Kim <namhyung@...nel.org>
To: Ian Rogers <irogers@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Nick Terrell <terrelln@...com>,
Kan Liang <kan.liang@...ux.intel.com>,
Andi Kleen <ak@...ux.intel.com>,
Kajol Jain <kjain@...ux.ibm.com>,
Athira Rajeev <atrajeev@...ux.vnet.ibm.com>,
Huacai Chen <chenhuacai@...nel.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Vincent Whitchurch <vincent.whitchurch@...s.com>,
"Steinar H. Gunderson" <sesse@...gle.com>,
Liam Howlett <liam.howlett@...cle.com>,
Miguel Ojeda <ojeda@...nel.org>,
Colin Ian King <colin.i.king@...il.com>,
Dmitrii Dolgov <9erthalion6@...il.com>,
Yang Jihong <yangjihong1@...wei.com>,
Ming Wang <wangming01@...ngson.cn>,
James Clark <james.clark@....com>,
K Prateek Nayak <kprateek.nayak@....com>,
Sean Christopherson <seanjc@...gle.com>,
Leo Yan <leo.yan@...aro.org>,
Ravi Bangoria <ravi.bangoria@....com>,
German Gomez <german.gomez@....com>,
Changbin Du <changbin.du@...wei.com>,
Paolo Bonzini <pbonzini@...hat.com>, Li Dong <lidong@...o.com>,
Sandipan Das <sandipan.das@....com>,
liuwenyu <liuwenyu7@...wei.com>, linux-kernel@...r.kernel.org,
linux-perf-users@...r.kernel.org,
Guilherme Amadio <amadio@...too.org>
Subject: Re: [PATCH v5 08/50] perf record: Be lazier in allocating lost
samples buffer
On Thu, Nov 30, 2023 at 10:29 AM Ian Rogers <irogers@...gle.com> wrote:
>
> On Wed, Nov 29, 2023 at 6:09 PM Namhyung Kim <namhyung@...nel.org> wrote:
> >
> > On Mon, Nov 27, 2023 at 2:09 PM Ian Rogers <irogers@...gle.com> wrote:
> > >
> > > Wait until a lost sample occurs to allocate the lost samples buffer,
> > > often the buffer isn't necessary. This saves a 64kb allocation and
> > > 5.3kb of peak memory consumption.
> > >
> > > Signed-off-by: Ian Rogers <irogers@...gle.com>
> > > ---
> > > tools/perf/builtin-record.c | 29 +++++++++++++++++++----------
> > > 1 file changed, 19 insertions(+), 10 deletions(-)
> > >
> > > diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> > > index 9b4f3805ca92..b6c8c1371b39 100644
> > > --- a/tools/perf/builtin-record.c
> > > +++ b/tools/perf/builtin-record.c
> > > @@ -1924,21 +1924,13 @@ static void __record__save_lost_samples(struct record *rec, struct evsel *evsel,
> > > static void record__read_lost_samples(struct record *rec)
> > > {
> > > struct perf_session *session = rec->session;
> > > - struct perf_record_lost_samples *lost;
> > > + struct perf_record_lost_samples *lost = NULL;
> > > struct evsel *evsel;
> > >
> > > /* there was an error during record__open */
> > > if (session->evlist == NULL)
> > > return;
> > >
> > > - lost = zalloc(PERF_SAMPLE_MAX_SIZE);
> >
> > To minimize the allocation size, this can be
> > sizeof(*lost) + session->machines.host.id_hdr_size
> > instead of PERF_SAMPLE_MAX_SIZE.
>
> Sounds good, should probably be a follow up. The current size is
> PERF_SAMPLE_MAX_SIZE.
Yep, I'm ok with having it as a follow-up.
Acked-by: Namhyung Kim <namhyung@...nel.org>
Thanks,
Namhyung
Powered by blists - more mailing lists