From: Arnd Bergmann <arnd@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@redhat.com>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
"Steven Rostedt (VMware)" <rostedt@godmis.org>,
Tom Zanussi <zanussi@kernel.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Qiujun Huang <hqjagain@gmail.com>, Tom Rix <trix@redhat.com>,
linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com
Subject: [PATCH] tracing: events_hist: avoid using excessive stack space
Date: Fri, 14 May 2021 16:04:25 +0200 [thread overview]
Message-ID: <20210514140429.3334181-1-arnd@kernel.org> (raw)
From: Arnd Bergmann <arnd@arndb.de>
In some configurations, clang produces a warning about an overly large
amount of stack space used in hist_trigger_print_key():
kernel/trace/trace_events_hist.c:4594:13: error: stack frame size of 1248 bytes in function 'hist_trigger_print_key' [-Werror,-Wframe-larger-than=]
static void hist_trigger_print_key(struct seq_file *m,
Moving the 'str' variable into a more local scope in the two places
where it gets used actually reduces the the used stack space here
and gets it below the warning limit, because the compiler can now
assume that it is safe to use the same stack slot that it has for
the stack of any inline function.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
kernel/trace/trace_events_hist.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index c1abd63f1d6c..e3fe84f017a8 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -4597,7 +4597,6 @@ static void hist_trigger_print_key(struct seq_file *m,
struct tracing_map_elt *elt)
{
struct hist_field *key_field;
- char str[KSYM_SYMBOL_LEN];
bool multiline = false;
const char *field_name;
unsigned int i;
@@ -4617,11 +4616,13 @@ static void hist_trigger_print_key(struct seq_file *m,
uval = *(u64 *)(key + key_field->offset);
seq_printf(m, "%s: %llx", field_name, uval);
} else if (key_field->flags & HIST_FIELD_FL_SYM) {
+ char str[KSYM_SYMBOL_LEN];
uval = *(u64 *)(key + key_field->offset);
sprint_symbol_no_offset(str, uval);
seq_printf(m, "%s: [%llx] %-45s", field_name,
uval, str);
} else if (key_field->flags & HIST_FIELD_FL_SYM_OFFSET) {
+ char str[KSYM_SYMBOL_LEN];
uval = *(u64 *)(key + key_field->offset);
sprint_symbol(str, uval);
seq_printf(m, "%s: [%llx] %-55s", field_name,
--
2.29.2
next reply other threads:[~2021-05-14 14:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-14 14:04 Arnd Bergmann [this message]
2021-05-14 14:16 ` Steven Rostedt
2021-05-14 18:33 ` Arnd Bergmann
2021-05-14 20:19 ` Nick Desaulniers
2021-05-14 21:14 ` Arnd Bergmann
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=20210514140429.3334181-1-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=arnd@arndb.de \
--cc=clang-built-linux@googlegroups.com \
--cc=hqjagain@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=rostedt@godmis.org \
--cc=rostedt@goodmis.org \
--cc=trix@redhat.com \
--cc=zanussi@kernel.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
all inboxes | Powered by JetHome®