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 0/4] Avoid some large stack allocations
Date: Mon, 12 Jun 2023 16:01:59 -0300 [thread overview]
Message-ID: <ZIdrp9OzTjQU32xZ@kernel.org> (raw)
In-Reply-To: <20230527034324.2597593-1-irogers@google.com>
Em Fri, May 26, 2023 at 08:43:18PM -0700, Ian Rogers escreveu:
> Following on cleaning up .data and .bss in:
> https://lore.kernel.org/lkml/20230526183401.2326121-1-irogers@google.com/
> Look for some probably too large stack allocations with -Wstack-usage=20000
> and pahole.
Thanks, applied.
- Arnaldo
> Don't attempt to cleanup variable length arrays like in:
> ```
> util/header.c: In function ‘write_cache’:
> util/header.c:1269:12: warning: stack usage might be unbounded [-Wstack-usage=]
> 1269 | static int write_cache(struct feat_fd *ff,
> | ^~~~~~~~~~~
> ```
>
> Also leave two allocations relating to session/event processing:
> ```
> util/auxtrace.c: In function ‘auxtrace_queues__add_indexed_event’:
> util/auxtrace.c:424:12: warning: stack usage is 65616 bytes [-Wstack-usage=]
> 424 | static int auxtrace_queues__add_indexed_event(struct auxtrace_queues *queues,
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> util/session.c: In function ‘perf_session__peek_events’:
> util/session.c:1822:5: warning: stack usage is 65648 bytes [-Wstack-usage=]
> 1822 | int perf_session__peek_events(struct perf_session *session, u64 offset,
> | ^~~~~~~~~~~~~~~~~~~~~~~~~
> ```
>
> The biggest win is for perf inject where 128kb becomes lazily
> allocated when aux or guest data is encountered.
>
> Ian Rogers (4):
> perf sched: Avoid large stack allocations
> perf script: Remove some large stack allocations
> perf inject: Lazily allocate event_copy
> perf inject: Lazily allocate guest_event event_buf
>
> tools/perf/builtin-inject.c | 31 +++++++++++++++++++++++++------
> tools/perf/builtin-sched.c | 26 ++++++++++++++++++++++----
> tools/perf/builtin-script.c | 17 +++++++++++++----
> 3 files changed, 60 insertions(+), 14 deletions(-)
>
> --
> 2.41.0.rc0.172.g3f132b7071-goog
>
--
- Arnaldo
prev parent reply other threads:[~2023-06-12 19:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-27 3:43 [PATCH v1 0/4] Avoid some large stack allocations Ian Rogers
2023-05-27 3:43 ` [PATCH v1 1/4] perf sched: Avoid " Ian Rogers
2023-05-27 3:43 ` [PATCH v1 2/4] perf script: Remove some " Ian Rogers
2023-05-27 3:43 ` [PATCH v1 3/4] perf inject: Lazily allocate event_copy Ian Rogers
2023-05-27 3:43 ` [PATCH v1 4/4] perf inject: Lazily allocate guest_event event_buf Ian Rogers
2023-06-12 19:01 ` 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=ZIdrp9OzTjQU32xZ@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).