[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZN0hgFJcnJiyKJjJ@slm.duckdns.org>
Date: Wed, 16 Aug 2023 09:20:32 -1000
From: Tejun Heo <tj@...nel.org>
To: Vishal Chourasia <vishalc@...ux.ibm.com>
Cc: torvalds@...ux-foundation.org, mingo@...hat.com,
peterz@...radead.org, juri.lelli@...hat.com,
vincent.guittot@...aro.org, dietmar.eggemann@....com,
rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
bristot@...hat.com, vschneid@...hat.com, ast@...nel.org,
daniel@...earbox.net, andrii@...nel.org, martin.lau@...nel.org,
joshdon@...gle.com, brho@...gle.com, pjt@...gle.com,
derkling@...gle.com, haoluo@...gle.com, dvernet@...a.com,
dschatzberg@...a.com, dskarlat@...cmu.edu, riel@...riel.com,
linux-kernel@...r.kernel.org, bpf@...r.kernel.org,
kernel-team@...a.com, Andrea Righi <andrea.righi@...onical.com>
Subject: Re: [PATCH 12/34] sched_ext: Implement BPF extensible scheduler class
Hello, Vishal.
On Wed, Aug 16, 2023 at 05:15:43PM +0530, Vishal Chourasia wrote:
> > +static inline bool task_on_scx(struct task_struct *p)
> > +{
> > + return scx_enabled() && p->sched_class == &ext_sched_class;
> > +}
> While building the kernel, I encountered the following warning:
>
> {KERNEL_SRC}/kernel/sched/core.c: In function ‘__task_prio’:
> {KERNEL_SRC}/kernel/sched/core.c:170:25: warning: passing argument 1 of ‘task_on_scx’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
> 170 | if (task_on_scx(p))
> | ^
> In file included from {KERNEL_SRC}/kernel/sched/sched.h:3593,
> from {KERNEL_SRC}/kernel/sched/core.c:86:
> {KERNEL_SRC}/kernel/sched/ext.h:124:52: note: expected ‘struct task_struct *’ but argument is of type ‘const struct task_struct *’
> 124 | static inline bool task_on_scx(struct task_struct *p)
> | ~~~~~~~~~~~~~~~~~~~~^
>
> To address this warning, I'd suggest modifying the signature of `task_on_scx` to
> accept `task_struct` argument as `const`. The proposed change is as follows:
>
> diff --git a/kernel/sched/ext.h b/kernel/sched/ext.h
> index 405037a4e6ce..e9c699a87770 100644
> --- a/kernel/sched/ext.h
> +++ b/kernel/sched/ext.h
> @@ -121,7 +121,7 @@ DECLARE_STATIC_KEY_FALSE(__scx_switched_all);
>
> DECLARE_STATIC_KEY_FALSE(scx_ops_cpu_preempt);
>
> -static inline bool task_on_scx(struct task_struct *p)
> +static inline bool task_on_scx(const struct task_struct *p)
> {
> return scx_enabled() && p->sched_class == &ext_sched_class;
> }
> @@ -214,7 +214,7 @@ bool scx_prio_less(const struct task_struct *a, const struct task_struct *b,
> #define scx_enabled() false
> #define scx_switched_all() false
>
> -static inline bool task_on_scx(struct task_struct *p) { return false; }
> +static inline bool task_on_scx(const struct task_struct *p) { return false; }
> static inline void scx_pre_fork(struct task_struct *p) {}
> static inline int scx_fork(struct task_struct *p) { return 0; }
> static inline void scx_post_fork(struct task_struct *p) {}
Yeah, this is already fixed in the github repo by the following commit:
https://github.com/sched-ext/sched_ext/commit/56b278fa8b5136457993f7389e34070d35f17e8a
The fix will be included in the next iteration.
Thanks.
--
tejun
Powered by blists - more mailing lists