mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] tools/sched_ext: avoid redefining SCX_ENQ_IMMED
@ 2026-03-26 10:03 Zhao Mengmeng
  2026-03-26 20:13 ` [PATCH sched_ext/for-7.1] tools/sched_ext: Remove redundant SCX_ENQ_IMMED compat definition Tejun Heo
  2026-03-26 20:14 ` [PATCH] tools/sched_ext: avoid redefining SCX_ENQ_IMMED Tejun Heo
  0 siblings, 2 replies; 4+ messages in thread
From: Zhao Mengmeng @ 2026-03-26 10:03 UTC (permalink / raw)
  To: tj, void, arighi, changwoo; +Cc: sched-ext, linux-kernel, zhaomengmeng

From: Zhao Mengmeng <zhaomengmeng@kylinos.cn>

Newer kernels generate SCX_ENQ_IMMED from enums.autogen.bpf.h,
while compat.bpf.h still defines a fallback macro unconditionally.
Including both headers then triggers a macro redefinition warning
when building BPF schedulers.

warning: 'SCX_ENQ_IMMED' macro redefined [-Wmacro-redefined]

Fix it by defining the compat fallback only when HAVE_SCX_ENQ_IMMED
is absent.

Fixes: 98d709cba319 ("sched_ext: Implement SCX_ENQ_IMMED")
Signed-off-by: Zhao Mengmeng <zhaomengmeng@kylinos.cn>
---
 tools/sched_ext/include/scx/compat.bpf.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/sched_ext/include/scx/compat.bpf.h b/tools/sched_ext/include/scx/compat.bpf.h
index 654b566bd94a..52e6fb9ea211 100644
--- a/tools/sched_ext/include/scx/compat.bpf.h
+++ b/tools/sched_ext/include/scx/compat.bpf.h
@@ -425,7 +425,9 @@ static inline void scx_bpf_dsq_reenq(u64 dsq_id, u64 reenq_flags)
 /*
  * v7.1: %SCX_ENQ_IMMED.
  */
+#ifndef HAVE_SCX_ENQ_IMMED
 #define SCX_ENQ_IMMED	__COMPAT_ENUM_OR_ZERO(enum scx_enq_flags, SCX_ENQ_IMMED)
+#endif
 
 /*
  * Define sched_ext_ops. This may be expanded to define multiple variants for
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-26 20:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-26 10:03 [PATCH] tools/sched_ext: avoid redefining SCX_ENQ_IMMED Zhao Mengmeng
2026-03-26 20:13 ` [PATCH sched_ext/for-7.1] tools/sched_ext: Remove redundant SCX_ENQ_IMMED compat definition Tejun Heo
2026-03-26 20:16   ` Tejun Heo
2026-03-26 20:14 ` [PATCH] tools/sched_ext: avoid redefining SCX_ENQ_IMMED Tejun Heo

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®