Re: [tip: sched/core] sched: Fix -Wmissing-prototype

From: Peter Oskolkov
Date: Fri Sep 17 2021 - 12:58:07 EST


On Thu, Sep 16, 2021 at 4:59 AM tip-bot2 for Peter Zijlstra
<tip-bot2@xxxxxxxxxxxxx> wrote:
>
> The following commit has been merged into the sched/core branch of tip:
>
> Commit-ID: 98a3270911f7abe2871a60799c20c95c9f991ddb

$ make defconfig
$ make -j16

ld: kernel/sched/core.o: in function `sched_free_group':
core.c:(.text+0x2cfd): undefined reference to `free_rt_sched_group'
ld: kernel/sched/core.o: in function `sched_create_group':
core.c:(.text+0xbdcb): undefined reference to `alloc_rt_sched_group'
ld: kernel/sched/core.o: in function `sched_init':
core.c:(.init.text+0x335): undefined reference to `init_cfs_bandwidth'
ld: kernel/sched/fair.o: in function `alloc_fair_sched_group':
fair.c:(.text+0x8427): undefined reference to `init_cfs_bandwidth'
make: *** [Makefile:1196: vmlinux] Error 1

Reverting this patch fixes the issue.

> Gitweb: https://git.kernel.org/tip/98a3270911f7abe2871a60799c20c95c9f991ddb
> Author: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> AuthorDate: Mon, 13 Sep 2021 15:27:44 +02:00
> Committer: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> CommitterDate: Wed, 15 Sep 2021 17:49:00 +02:00
>
> sched: Fix -Wmissing-prototype
>
> kernel/sched/fair.c:5403:6: warning: no previous prototype for ‘init_cfs_bandwidth’ [-Wmissing-prototypes]
> kernel/sched/fair.c:11525:6: warning: no previous prototype for ‘free_fair_sched_group’ [-Wmissing-prototypes]
> kernel/sched/fair.c:11527:5: warning: no previous prototype for ‘alloc_fair_sched_group’ [-Wmissing-prototypes]
> kernel/sched/fair.c:11532:6: warning: no previous prototype for ‘online_fair_sched_group’ [-Wmissing-prototypes]
> kernel/sched/fair.c:11534:6: warning: no previous prototype for ‘unregister_fair_sched_group’ [-Wmissing-prototypes]
>
> kernel/sched/rt.c:253:6: warning: no previous prototype for ‘free_rt_sched_group’ [-Wmissing-prototypes]
> kernel/sched/rt.c:255:5: warning: no previous prototype for ‘alloc_rt_sched_group’ [-Wmissing-prototypes]
> kernel/sched/rt.c:669:6: warning: no previous prototype for ‘sched_rt_bandwidth_account’ [-Wmissing-prototypes]
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> ---
> kernel/sched/deadline.c | 2 --
> kernel/sched/fair.c | 15 ---------------
> kernel/sched/rt.c | 6 ------
> kernel/sched/sched.h | 2 ++
> 4 files changed, 2 insertions(+), 23 deletions(-)
>
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index d2c072b..29dd188 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -1191,8 +1191,6 @@ int dl_runtime_exceeded(struct sched_dl_entity *dl_se)
> return (dl_se->runtime <= 0);
> }
>
> -extern bool sched_rt_bandwidth_account(struct rt_rq *rt_rq);
> -
> /*
> * This function implements the GRUB accounting rule:
> * according to the GRUB reclaiming algorithm, the runtime is
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index e26d622..9571254 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -5408,8 +5408,6 @@ static inline int throttled_lb_pair(struct task_group *tg,
> return 0;
> }
>
> -void init_cfs_bandwidth(struct cfs_bandwidth *cfs_b) {}
> -
> #ifdef CONFIG_FAIR_GROUP_SCHED
> static void init_cfs_rq_runtime(struct cfs_rq *cfs_rq) {}
> #endif
> @@ -11562,19 +11560,6 @@ next_cpu:
> return 0;
> }
>
> -#else /* CONFIG_FAIR_GROUP_SCHED */
> -
> -void free_fair_sched_group(struct task_group *tg) { }
> -
> -int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent)
> -{
> - return 1;
> -}
> -
> -void online_fair_sched_group(struct task_group *tg) { }
> -
> -void unregister_fair_sched_group(struct task_group *tg) { }
> -
> #endif /* CONFIG_FAIR_GROUP_SCHED */
>
>
> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> index bb945f8..929fb37 100644
> --- a/kernel/sched/rt.c
> +++ b/kernel/sched/rt.c
> @@ -250,12 +250,6 @@ static inline struct rt_rq *rt_rq_of_se(struct sched_rt_entity *rt_se)
> return &rq->rt;
> }
>
> -void free_rt_sched_group(struct task_group *tg) { }
> -
> -int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent)
> -{
> - return 1;
> -}
> #endif /* CONFIG_RT_GROUP_SCHED */
>
> #ifdef CONFIG_SMP
> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index 094ea86..1d8bc76 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -3065,3 +3065,5 @@ extern int sched_dynamic_mode(const char *str);
> extern void sched_dynamic_update(int mode);
> #endif
>
> +extern bool sched_rt_bandwidth_account(struct rt_rq *rt_rq);
> +