aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTejun Heo <[email protected]>2024-07-31 08:56:31 -1000
committerTejun Heo <[email protected]>2024-08-01 07:08:01 -1000
commita2f4b16e736d62892ffd333996a7d682b57f6664 (patch)
tree0c7020e73715691cd881c028a85601759b93f573
parent958b1891846e768584a4d44aed9fabc6f9a445fb (diff)
sched_ext: Build fix on !CONFIG_STACKTRACE[_SUPPORT]
scx_dump_task() uses stack_trace_save_tsk() which is only available when CONFIG_STACKTRACE. Make CONFIG_SCHED_CLASS_EXT select CONFIG_STACKTRACE if the support is available and skip capturing stack trace if !CONFIG_STACKTRACE. Signed-off-by: Tejun Heo <[email protected]> Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Acked-by: David Vernet <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
-rw-r--r--kernel/Kconfig.preempt1
-rw-r--r--kernel/sched/ext.c4
2 files changed, 4 insertions, 1 deletions
diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt
index f3d140c3acc1..fe782cd77388 100644
--- a/kernel/Kconfig.preempt
+++ b/kernel/Kconfig.preempt
@@ -136,6 +136,7 @@ config SCHED_CORE
config SCHED_CLASS_EXT
bool "Extensible Scheduling Class"
depends on BPF_SYSCALL && BPF_JIT && DEBUG_INFO_BTF
+ select STACKTRACE if STACKTRACE_SUPPORT
help
This option enables a new scheduler class sched_ext (SCX), which
allows scheduling policies to be implemented as BPF programs to
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index 4a07deb30c44..6f7c7d8b56de 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -4330,7 +4330,7 @@ static void scx_dump_task(struct seq_buf *s, struct scx_dump_ctx *dctx,
static unsigned long bt[SCX_EXIT_BT_LEN];
char dsq_id_buf[19] = "(n/a)";
unsigned long ops_state = atomic_long_read(&p->scx.ops_state);
- unsigned int bt_len;
+ unsigned int bt_len = 0;
if (p->scx.dsq)
scnprintf(dsq_id_buf, sizeof(dsq_id_buf), "0x%llx",
@@ -4355,7 +4355,9 @@ static void scx_dump_task(struct seq_buf *s, struct scx_dump_ctx *dctx,
ops_dump_exit();
}
+#ifdef CONFIG_STACKTRACE
bt_len = stack_trace_save_tsk(p, bt, SCX_EXIT_BT_LEN, 1);
+#endif
if (bt_len) {
dump_newline(s);
dump_stack_trace(s, " ", bt, bt_len);