All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] perf record: Reduce memory for recording lost samples event
Date: Wed, 3 Jan 2024 13:45:38 -0300	[thread overview]
Message-ID: <ZZWPMsSm3JwAu7_R@kernel.org> (raw)
In-Reply-To: <20231207021627.1322884-1-irogers@google.com>

Em Wed, Dec 06, 2023 at 06:16:27PM -0800, Ian Rogers escreveu:
> Reduce from PERF_SAMPLE_MAX_SIZE to "sizeof(*lost) +
> session->machines.host.id_hdr_size".
> 
> Suggested-by: Namhyung Kim <namhyung@kernel.org>


Thanks, applied to perf-tools-next.

- Arnaldo


> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> Suggested in:
> https://lore.kernel.org/lkml/CAM9d7cjpYHN_Q63sW70vTCisdW=-SzjsrryUUJjgtZ3+9jdxfA@mail.gmail.com/
> ---
>  tools/perf/builtin-record.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> index eb5a398ddb1d..206110fc2799 100644
> --- a/tools/perf/builtin-record.c
> +++ b/tools/perf/builtin-record.c
> @@ -1954,7 +1954,8 @@ static void record__read_lost_samples(struct record *rec)
>  
>  				if (count.lost) {
>  					if (!lost) {
> -						lost = zalloc(PERF_SAMPLE_MAX_SIZE);
> +						lost = zalloc(sizeof(*lost) +
> +							      session->machines.host.id_hdr_size);
>  						if (!lost) {
>  							pr_debug("Memory allocation failed\n");
>  							return;
> @@ -1970,7 +1971,8 @@ static void record__read_lost_samples(struct record *rec)
>  		lost_count = perf_bpf_filter__lost_count(evsel);
>  		if (lost_count) {
>  			if (!lost) {
> -				lost = zalloc(PERF_SAMPLE_MAX_SIZE);
> +				lost = zalloc(sizeof(*lost) +
> +					      session->machines.host.id_hdr_size);
>  				if (!lost) {
>  					pr_debug("Memory allocation failed\n");
>  					return;
> -- 
> 2.43.0.rc2.451.g8631bc7472-goog
> 

-- 

- Arnaldo

      parent reply	other threads:[~2024-01-03 16:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07  2:16 [PATCH v1] perf record: Reduce memory for recording lost samples event Ian Rogers
2024-01-03  2:59 ` Ian Rogers
2024-01-03 16:45 ` Arnaldo Carvalho de Melo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZZWPMsSm3JwAu7_R@kernel.org \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.