From: Andrea Righi <arighi@nvidia.com>
To: Tejun Heo <tj@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
David Vernet <void@manifault.com>,
Changwoo Min <changwoo@igalia.com>,
Emil Tsalapatis <emil@etsalapatis.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
sched-ext@lists.linux.dev
Subject: Re: [PATCH sched_ext/for-7.2 1/2] sched_ext: Make kernel/sched/ext/ sources self-contained for clangd
Date: Mon, 22 Jun 2026 20:26:18 +0200 [thread overview]
Message-ID: <ajl-SgjY16AiTTMj@gpd4> (raw)
In-Reply-To: <20260622173904.1169407-1-tj@kernel.org>
Hi Tejun,
On Mon, Jun 22, 2026 at 07:39:03AM -1000, Tejun Heo wrote:
> The sources under kernel/sched/ext/ build as a single translation unit:
> build_policy.c includes the source files and headers. An LSP/clangd editor
> parses each as a standalone unit, sees no types, and reports a flood of
> errors.
>
> Give each header its dependencies and include guard, and have each source
> include the headers it uses.
>
> ext.c, arena.c and the ext headers now parse clean standalone. idle.c and
> cid.c still reference a few macros and helpers defined in ext.c. The next
> patch moves those to shared headers.
>
> Suggested-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> ---
...
> diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
> index 00fe6cc6d7e2..ebf6dc84cb4d 100644
> --- a/kernel/sched/ext/ext.c
> +++ b/kernel/sched/ext/ext.c
> @@ -6,6 +6,18 @@
> * Copyright (c) 2022 Tejun Heo <tj@kernel.org>
> * Copyright (c) 2022 David Vernet <dvernet@meta.com>
> */
> +#include <linux/bitmap.h>
> +#include <linux/btf_ids.h>
> +#include <linux/rhashtable.h>
> +#include <linux/sched/isolation.h>
> +#include <linux/suspend.h>
> +#include <linux/sysrq.h>
I'm getting the following errors here:
kernel/sched/ext/ext.c|1296 col 26-41 error| Call to undeclared function 'sched_clock_cpu'; ISO C99 and later do not support implicit function declarations (fix available)
kernel/sched/ext/ext.c|7772 col 10-11 error| In included file: conflicting types for 'sched_clock_cpu'
They can be fixed adding:
#include <linux/sched/clock.h>
> +
> +#include "../pelt.h"
> +#include "internal.h"
> +#include "cid.h"
> +#include "arena.h"
> +#include "idle.h"
>
> static DEFINE_RAW_SPINLOCK(scx_sched_lock);
>
> diff --git a/kernel/sched/ext/idle.c b/kernel/sched/ext/idle.c
> index 2077373d8da3..8e8c6201b7df 100644
> --- a/kernel/sched/ext/idle.c
> +++ b/kernel/sched/ext/idle.c
> @@ -9,6 +9,9 @@
> * Copyright (c) 2022 David Vernet <dvernet@meta.com>
> * Copyright (c) 2024 Andrea Righi <arighi@nvidia.com>
> */
> +#include "internal.h"
> +#include "cid.h"
> +#include "idle.h"
>
> /* Enable/disable built-in idle CPU selection policy */
> static DEFINE_STATIC_KEY_FALSE(scx_builtin_idle_enabled);
> diff --git a/kernel/sched/ext/idle.h b/kernel/sched/ext/idle.h
> index 8d169d3bbdf9..f75699d22177 100644
> --- a/kernel/sched/ext/idle.h
> +++ b/kernel/sched/ext/idle.h
> @@ -10,6 +10,10 @@
> #ifndef _KERNEL_SCHED_EXT_IDLE_H
> #define _KERNEL_SCHED_EXT_IDLE_H
>
> +#include <linux/btf_ids.h>
> +
> +#include "../sched.h"
And here I'm getting a warning, I've fixed it adding the following forward
declarations instead of including sched.h:
struct cpumask;
struct task_struct;
> +
> struct sched_ext_ops;
>
> extern struct btf_id_set8 scx_kfunc_ids_idle;
With these two additional changes, everything looks good to me.
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Thanks,
-Andrea
next prev parent reply other threads:[~2026-06-22 18:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-22 17:39 [PATCH sched_ext/for-7.2 1/2] sched_ext: Make kernel/sched/ext/ sources self-contained for clangd Tejun Heo
2026-06-22 17:39 ` [PATCH sched_ext/for-7.2 2/2] sched_ext: Move shared helpers from ext.c into internal.h and cid.h Tejun Heo
2026-06-22 18:45 ` Andrea Righi
2026-06-22 18:26 ` Andrea Righi [this message]
2026-06-22 20:37 ` [PATCH v2 sched_ext/for-7.2 1/2] sched_ext: Make kernel/sched/ext/ sources self-contained for clangd Tejun Heo
2026-06-22 21:05 ` [PATCH " Tejun Heo
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=ajl-SgjY16AiTTMj@gpd4 \
--to=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=emil@etsalapatis.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=sched-ext@lists.linux.dev \
--cc=tj@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=vincent.guittot@linaro.org \
--cc=void@manifault.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.