From: Rosen Penev <rosenp@gmail.com>
To: sched-ext@lists.linux.dev
Cc: Tejun Heo <tj@kernel.org>, David Vernet <void@manifault.com>,
Andrea Righi <arighi@nvidia.com>,
Changwoo Min <changwoo@igalia.com>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
K Prateek Nayak <kprateek.nayak@amd.com>,
linux-kernel@vger.kernel.org (open list:SCHEDULER)
Subject: [PATCH] sched/ext: Use flexible array for exit backtraces
Date: Mon, 11 May 2026 18:08:11 -0700 [thread overview]
Message-ID: <20260512010811.40754-1-rosenp@gmail.com> (raw)
Store the fixed-size exit backtrace buffer in the sched_ext exit info
allocation instead of allocating it separately.
This ties the backtrace buffer lifetime directly to the exit info object
and removes a separate allocation failure path.
Assisted-by: Codex:GPT-5.5
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
kernel/sched/ext.c | 6 ++----
kernel/sched/ext_internal.h | 8 ++++----
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index 1d7f206941f0..f8d18406cfa6 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -5628,7 +5628,6 @@ static void free_exit_info(struct scx_exit_info *ei)
{
kvfree(ei->dump);
kfree(ei->msg);
- kfree(ei->bt);
kfree(ei);
}
@@ -5636,16 +5635,15 @@ static struct scx_exit_info *alloc_exit_info(size_t exit_dump_len)
{
struct scx_exit_info *ei;
- ei = kzalloc_obj(*ei);
+ ei = kzalloc_flex(*ei, bt, SCX_EXIT_BT_LEN);
if (!ei)
return NULL;
ei->exit_cpu = -1;
- ei->bt = kzalloc_objs(ei->bt[0], SCX_EXIT_BT_LEN);
ei->msg = kzalloc(SCX_EXIT_MSG_LEN, GFP_KERNEL);
ei->dump = kvzalloc(exit_dump_len, GFP_KERNEL);
- if (!ei->bt || !ei->msg || !ei->dump) {
+ if (!ei->msg || !ei->dump) {
free_exit_info(ei);
return NULL;
}
diff --git a/kernel/sched/ext_internal.h b/kernel/sched/ext_internal.h
index 0ed79bd891c7..9fde7f1eee01 100644
--- a/kernel/sched/ext_internal.h
+++ b/kernel/sched/ext_internal.h
@@ -80,15 +80,15 @@ struct scx_exit_info {
/* textual representation of the above */
const char *reason;
- /* backtrace if exiting due to an error */
- unsigned long *bt;
- u32 bt_len;
-
/* informational message */
char *msg;
/* debug dump */
char *dump;
+
+ /* backtrace if exiting due to an error */
+ u32 bt_len;
+ unsigned long bt[];
};
/* sched_ext_ops.flags */
--
2.54.0
reply other threads:[~2026-05-12 1:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260512010811.40754-1-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=arighi@nvidia.com \
--cc=bsegall@google.com \
--cc=changwoo@igalia.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sched-ext@lists.linux.dev \
--cc=tj@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=void@manifault.com \
--cc=vschneid@redhat.com \
/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