]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
sched_ext: Avoid flooding the log with deprecation warnings
authorBreno Leitao <leitao@debian.org>
Wed, 24 Jun 2026 09:27:43 +0000 (02:27 -0700)
committerTejun Heo <tj@kernel.org>
Wed, 24 Jun 2026 18:54:28 +0000 (08:54 -1000)
The deprecation notices for direct p->scx.slice/dsq_vtime writes and for
ops->cpu_acquire/release() use plain pr_warn(), so they repeat on every
scheduler (re)load and can flood the kernel log.

The slice/dsq_vtime notice is the worst offender: it is emitted from the
BPF verifier's btf_struct_access callback, which is re-evaluated as the
verifier explores program paths, so a single scheduler load can print it
many times -- hundreds of lines on some hosts, dozens within the same
second.

Switch both notices to pr_warn_ratelimited() so each deprecation is still
reported but bursts no longer spam the log, and add the missing newline
to the slice/dsq_vtime message.

Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/sched/ext/ext.c

index 691d53fe0f648898d5b40a8ff8b2fbe9a1ee17db..d62b93f48a85450aefd4e90abf605d55f3857ae8 100644 (file)
@@ -6988,7 +6988,7 @@ static int validate_ops(struct scx_sched *sch, const struct sched_ext_ops *ops)
         * run past the BPF allocation. Skip for cid-form.
         */
        if (!sch->is_cid_type && (ops->cpu_acquire || ops->cpu_release))
-               pr_warn("ops->cpu_acquire/release() are deprecated, use sched_switch TP instead\n");
+               pr_warn_ratelimited("ops->cpu_acquire/release() are deprecated, use sched_switch TP instead\n");
 
        /*
         * Sub-scheduler support is tied to the cid-form struct_ops. A sub-sched
@@ -7806,7 +7806,7 @@ static int bpf_scx_btf_struct_access(struct bpf_verifier_log *log,
                     off + size <= offsetofend(struct task_struct, scx.slice)) ||
                    (off >= offsetof(struct task_struct, scx.dsq_vtime) &&
                     off + size <= offsetofend(struct task_struct, scx.dsq_vtime))) {
-                       pr_warn("sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()");
+                       pr_warn_ratelimited("sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()\n");
                        return SCALAR_VALUE;
                }