Skip to contentSkip to conversation

sched: address missing-prototype warnings

PATCH Applied Arnd Bergmann 5 participants 17 messages May 22, 2023 – May 31, 2023 Scheduler

lore
Share & tools
lore
#0 lore raw

cover sched: address missing-prototype warnings

From: Arnd Bergmann <[email protected]>

I sent out a lot of -Wmissing-prototype warnings already, but noticed that I missed some of the patches I did for the scheduler.

Addressing this is mainly useful in order to allow turning the warning on by default in the future, but I also tried to improe the code where possible.

Arnd Bergmann (5):
sched: hide unused sched_update_scaling()
sched: add schedule_user() declaration
sched: fair: hide unused init_cfs_bandwidth() stub
sched: make task_vruntime_update() prototype visible
sched: fair: move unused stub functions to header

 kernel/sched/core.c  |  2 --
 kernel/sched/fair.c  | 19 +++----------------
 kernel/sched/sched.h | 13 +++++++++++++
 3 files changed, 16 insertions(+), 18 deletions(-)
Signature · 13 lines
2.39.2

Cc: Ingo Molnar <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Juri Lelli <[email protected]>
Cc: Vincent Guittot <[email protected]>
Cc: Dietmar Eggemann <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Ben Segall <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Daniel Bristot de Oliveira <[email protected]>
Cc: Valentin Schneider <[email protected]>
Cc: [email protected]
#1 lore raw

PATCH 1/5 sched: hide unused sched_update_scaling()

From: Arnd Bergmann <[email protected]>

This function is only used when CONFIG_SMP is enabled, without that there is no caller and no prototype:

kernel/sched/fair.c:688:5: error: no previous prototype for 'sched_update_scaling' [-Werror=missing-prototypes

Hide the definition in the same #ifdef check as the declaration.

Fixes 8a99b6833c88 ("sched: Move SCHED_DEBUG sysctl to debugfs")
---
 kernel/sched/fair.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/sched/fair.c +2 -1
index 48b6f0ca13ac..2c1b345c3b8d 100644
@@ -684,7 +684,7 @@ struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq)
 /**************************************************************
  * Scheduling class statistics methods:
  */
-
+#ifdef CONFIG_SMP
 int sched_update_scaling(void)
 {
 	unsigned int factor = get_update_sysctl_factor();
@@ -702,6 +702,7 @@ int sched_update_scaling(void)
 	return 0;
 }
 #endif
+#endif
 
 /*
  * delta /= w
Signature · 1 line
2.39.2
Reviewed-by on v1 1/5
#2 lore raw

Re: [PATCH 1/5] sched: hide unused sched_update_scaling()

Quoted 11 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

This function is only used when CONFIG_SMP is enabled, without that there is no caller and no prototype:

kernel/sched/fair.c:688:5: error: no previous prototype for 'sched_update_scaling' [-Werror=missing-prototypes

Hide the definition in the same #ifdef check as the declaration.

Fixes 8a99b6833c88 ("sched: Move SCHED_DEBUG sysctl to debugfs")

LGTM, thanks.

-- Mukesh

Quoted 25 lines
---
  kernel/sched/fair.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
kernel/sched/fair.c +2 -1
index 48b6f0ca13ac..2c1b345c3b8d 100644
@@ -684,7 +684,7 @@ struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq)
  /**************************************************************
   * Scheduling class statistics methods:
   */
-
+#ifdef CONFIG_SMP
  int sched_update_scaling(void)
  {
  	unsigned int factor = get_update_sysctl_factor();
@@ -702,6 +702,7 @@ int sched_update_scaling(void)
  	return 0;
  }
  #endif
+#endif
 
  /*
   * delta /= w
merge bot Applied
#3 lore raw

[tip: sched/core] sched: Hide unused sched_update_scaling()

In reply to Arnd Bergmann
The following commit has been merged into the sched/core branch of tip:

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     d55ebae3f3122b07689cc4c34043114e09ce904c
Gitweb:        https://git.kernel.org/tip/d55ebae3f3122b07689cc4c34043114e09ce904c
Author:        Arnd Bergmann <[email protected]>
AuthorDate:    Mon, 22 May 2023 21:50:17 +02:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Tue, 30 May 2023 22:46:24 +02:00

sched: Hide unused sched_update_scaling()

This function is only used when CONFIG_SMP is enabled, without that there is no caller and no prototype:

kernel/sched/fair.c:688:5: error: no previous prototype for 'sched_update_scaling' [-Werror=missing-prototypes

Hide the definition in the same #ifdef check as the declaration.

---
 kernel/sched/fair.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/sched/fair.c +2 -1
index 48b6f0c..2c1b345 100644
@@ -684,7 +684,7 @@ struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq)
 /**************************************************************
  * Scheduling class statistics methods:
  */
-
+#ifdef CONFIG_SMP
 int sched_update_scaling(void)
 {
 	unsigned int factor = get_update_sysctl_factor();
@@ -702,6 +702,7 @@ int sched_update_scaling(void)
 	return 0;
 }
 #endif
+#endif
 
 /*
  * delta /= w
#4 lore raw

PATCH 2/5 sched: add schedule_user() declaration

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The schedule_user() function is used on powerpc and sparc architectures, but only ever called from assembler, so it has no prototype, causing a harmless W=1 warning:

kernel/sched/core.c:6730:35: error: no previous prototype for 'schedule_user' [-Werror=missing-prototypes]

Add a prototype in sched/sched.h to shut up the warning.

---
 kernel/sched/sched.h | 1 +
 1 file changed, 1 insertion(+)
kernel/sched/sched.h +1 -0
index 1704763897d0..44b34836bb60 100644
@@ -2376,6 +2376,7 @@ static inline struct cpuidle_state *idle_get_state(struct rq *rq)
 #endif
 
 extern void schedule_idle(void);
+asmlinkage void schedule_user(void);
 
 extern void sysrq_sched_debug_show(void);
 extern void sched_init_granularity(void);
Signature · 1 line
2.39.2
merge bot Applied
#5 lore raw

[tip: sched/core] sched: Add schedule_user() declaration

The following commit has been merged into the sched/core branch of tip:

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     378be384e01f13fc44d0adc70873de525586ad74
Gitweb:        https://git.kernel.org/tip/378be384e01f13fc44d0adc70873de525586ad74
Author:        Arnd Bergmann <[email protected]>
AuthorDate:    Mon, 22 May 2023 21:50:18 +02:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Tue, 30 May 2023 22:46:25 +02:00

sched: Add schedule_user() declaration

The schedule_user() function is used on powerpc and sparc architectures, but only ever called from assembler, so it has no prototype, causing a harmless W=1 warning:

kernel/sched/core.c:6730:35: error: no previous prototype for 'schedule_user' [-Werror=missing-prototypes]

Add a prototype in sched/sched.h to shut up the warning.

---
 kernel/sched/sched.h | 1 +
 1 file changed, 1 insertion(+)
kernel/sched/sched.h +1 -0
index 6784462..192e781 100644
@@ -2376,6 +2376,7 @@ static inline struct cpuidle_state *idle_get_state(struct rq *rq)
 #endif
 
 extern void schedule_idle(void);
+asmlinkage void schedule_user(void);
 
 extern void sysrq_sched_debug_show(void);
 extern void sched_init_granularity(void);
#6 lore raw

PATCH 3/5 sched: fair: hide unused init_cfs_bandwidth() stub

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

init_cfs_bandwidth() is only used when CONFIG_FAIR_GROUP_SCHED is enabled, and without this causes a W=1 warning for the missing prototype:

kernel/sched/fair.c:6131:6: error: no previous prototype for 'init_cfs_bandwidth'

The normal implementation is only defined for CONFIG_CFS_BANDWIDTH, so the stub exists when CFS_BANDWIDTH is disabled but FAIR_GROUP_SCHED is enabled.

---
 kernel/sched/fair.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/sched/fair.c +1 -2
index 2c1b345c3b8d..a7a8ccde3bd7 100644
@@ -6169,9 +6169,8 @@ 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
+void init_cfs_bandwidth(struct cfs_bandwidth *cfs_b) {}
 static void init_cfs_rq_runtime(struct cfs_rq *cfs_rq) {}
 #endif
 
Signature · 1 line
2.39.2
Reviewed-by on v1 3/5
#7 lore raw

Re: [PATCH 3/5] sched: fair: hide unused init_cfs_bandwidth() stub

Quoted 5 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

init_cfs_bandwidth() is only used when CONFIG_FAIR_GROUP_SCHED is enabled, and without this causes a W=1 warning for the missing prototype:

Quoted 7 lines

kernel/sched/fair.c:6131:6: error: no previous prototype for 'init_cfs_bandwidth'

The normal implementation is only defined for CONFIG_CFS_BANDWIDTH, so the stub exists when CFS_BANDWIDTH is disabled but FAIR_GROUP_SCHED is enabled.

-- Mukesh

Quoted 19 lines
---
  kernel/sched/fair.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
kernel/sched/fair.c +1 -2
index 2c1b345c3b8d..a7a8ccde3bd7 100644
@@ -6169,9 +6169,8 @@ 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
+void init_cfs_bandwidth(struct cfs_bandwidth *cfs_b) {}
  static void init_cfs_rq_runtime(struct cfs_rq *cfs_rq) {}
  #endif
 
merge bot Applied
#8 lore raw

[tip: sched/core] sched/fair: Hide unused init_cfs_bandwidth() stub

In reply to Arnd Bergmann
The following commit has been merged into the sched/core branch of tip:

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     c0bdfd72fbfb7319581bd5bb09b4f10979385bac
Gitweb:        https://git.kernel.org/tip/c0bdfd72fbfb7319581bd5bb09b4f10979385bac
Author:        Arnd Bergmann <[email protected]>
AuthorDate:    Mon, 22 May 2023 21:50:19 +02:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Tue, 30 May 2023 22:46:25 +02:00

sched/fair: Hide unused init_cfs_bandwidth() stub

init_cfs_bandwidth() is only used when CONFIG_FAIR_GROUP_SCHED is enabled, and without this causes a W=1 warning for the missing prototype:

kernel/sched/fair.c:6131:6: error: no previous prototype for 'init_cfs_bandwidth'

The normal implementation is only defined for CONFIG_CFS_BANDWIDTH, so the stub exists when CFS_BANDWIDTH is disabled but FAIR_GROUP_SCHED is enabled.

---
 kernel/sched/fair.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/sched/fair.c +1 -2
index 2c1b345..a7a8ccd 100644
@@ -6169,9 +6169,8 @@ 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
+void init_cfs_bandwidth(struct cfs_bandwidth *cfs_b) {}
 static void init_cfs_rq_runtime(struct cfs_rq *cfs_rq) {}
 #endif
 
#9 lore raw

PATCH 4/5 sched: make task_vruntime_update() prototype visible

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Having the prototype next to the caller but not visible to the callee causes a W=1 warning:

kernel/sched/fair.c:11985:6: error: no previous prototype for 'task_vruntime_update' [-Werror=missing-prototypes]

Move this to a header, as we do for all other function declarations.

---
 kernel/sched/core.c  | 2 --
 kernel/sched/sched.h | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)
kernel/sched/core.c +0 -2
index 044bcdf4181a..aae6ff717c55 100644
@@ -6030,8 +6030,6 @@ static inline struct task_struct *pick_task(struct rq *rq)
 	BUG(); /* The idle class should always have a runnable task. */
 }
 
-extern void task_vruntime_update(struct rq *rq, struct task_struct *p, bool in_fi);
-
 static void queue_core_balance(struct rq *rq);
 
 static struct task_struct *
kernel/sched/sched.h +1 -0
index 44b34836bb60..d5ac0af1eede 100644
@@ -1245,6 +1245,7 @@ static inline raw_spinlock_t *__rq_lockp(struct rq *rq)
 
 bool cfs_prio_less(const struct task_struct *a, const struct task_struct *b,
 			bool fi);
+void task_vruntime_update(struct rq *rq, struct task_struct *p, bool in_fi);
 
 /*
  * Helpers to check if the CPU's core cookie matches with the task's cookie
Signature · 1 line
2.39.2
Reviewed-by on v1 4/5
#10 lore raw

Re: [PATCH 4/5] sched: make task_vruntime_update() prototype visible

Quoted 10 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Having the prototype next to the caller but not visible to the callee causes a W=1 warning:

kernel/sched/fair.c:11985:6: error: no previous prototype for 'task_vruntime_update' [-Werror=missing-prototypes]

Move this to a header, as we do for all other function declarations.

LGTM.

-- Mukesh

Quoted 30 lines
---
  kernel/sched/core.c  | 2 --
  kernel/sched/sched.h | 1 +
  2 files changed, 1 insertion(+), 2 deletions(-)
kernel/sched/core.c +0 -2
index 044bcdf4181a..aae6ff717c55 100644
@@ -6030,8 +6030,6 @@ static inline struct task_struct *pick_task(struct rq *rq)
  	BUG(); /* The idle class should always have a runnable task. */
  }
 
-extern void task_vruntime_update(struct rq *rq, struct task_struct *p, bool in_fi);
-
  static void queue_core_balance(struct rq *rq);
 
  static struct task_struct *
kernel/sched/sched.h +1 -0
index 44b34836bb60..d5ac0af1eede 100644
@@ -1245,6 +1245,7 @@ static inline raw_spinlock_t *__rq_lockp(struct rq *rq)
 
  bool cfs_prio_less(const struct task_struct *a, const struct task_struct *b,
  			bool fi);
+void task_vruntime_update(struct rq *rq, struct task_struct *p, bool in_fi);
 
  /*
   * Helpers to check if the CPU's core cookie matches with the task's cookie
merge bot Applied
#11 lore raw

[tip: sched/core] sched: Make task_vruntime_update() prototype visible

In reply to Arnd Bergmann
The following commit has been merged into the sched/core branch of tip:

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     f7df852ad6dbb84644e75df7402d9a34f39f31bd
Gitweb:        https://git.kernel.org/tip/f7df852ad6dbb84644e75df7402d9a34f39f31bd
Author:        Arnd Bergmann <[email protected]>
AuthorDate:    Mon, 22 May 2023 21:50:20 +02:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Tue, 30 May 2023 22:46:26 +02:00

sched: Make task_vruntime_update() prototype visible

Having the prototype next to the caller but not visible to the callee causes a W=1 warning:

kernel/sched/fair.c:11985:6: error: no previous prototype for 'task_vruntime_update' [-Werror=missing-prototypes]

Move this to a header, as we do for all other function declarations.

---
 kernel/sched/sched.h | 1 +
 1 file changed, 1 insertion(+)
kernel/sched/sched.h +1 -0
index 192e781..ce07782 100644
@@ -1245,6 +1245,7 @@ static inline raw_spinlock_t *__rq_lockp(struct rq *rq)
 
 bool cfs_prio_less(const struct task_struct *a, const struct task_struct *b,
 			bool fi);
+void task_vruntime_update(struct rq *rq, struct task_struct *p, bool in_fi);
 
 /*
  * Helpers to check if the CPU's core cookie matches with the task's cookie
#12 lore raw

PATCH 5/5 sched: fair: move unused stub functions to header

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

These four functions have a normal definition for CONFIG_FAIR_GROUP_SCHED, and empty one that is only referenced when FAIR_GROUP_SCHED is disabled but CGROUP_SCHED is still enabled. If both are turned off, the functions are still defined but the misisng prototype causes a W=1 warning:

kernel/sched/fair.c:12544:6: error: no previous prototype for 'free_fair_sched_group' kernel/sched/fair.c:12546:5: error: no previous prototype for 'alloc_fair_sched_group' kernel/sched/fair.c:12553:6: error: no previous prototype for 'online_fair_sched_group' kernel/sched/fair.c:12555:6: error: no previous prototype for 'unregister_fair_sched_group'

Move the alternatives into the header as static inline functions with the correct combination of #ifdef checks to avoid the warning without adding even more complexity.

---
 kernel/sched/fair.c  | 13 -------------
 kernel/sched/sched.h | 11 +++++++++++
 2 files changed, 11 insertions(+), 13 deletions(-)
kernel/sched/fair.c +0 -13
index a7a8ccde3bd7..bae8907c1635 100644
@@ -12602,19 +12602,6 @@ int sched_group_set_idle(struct task_group *tg, long idle)
 	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 */
 
 
kernel/sched/sched.h +11 -0
index d5ac0af1eede..0584fa15ffeb 100644
@@ -453,10 +453,21 @@ static inline int walk_tg_tree(tg_visitor down, tg_visitor up, void *data)
 
 extern int tg_nop(struct task_group *tg, void *data);
 
+#ifdef CONFIG_FAIR_GROUP_SCHED
 extern void free_fair_sched_group(struct task_group *tg);
 extern int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent);
 extern void online_fair_sched_group(struct task_group *tg);
 extern void unregister_fair_sched_group(struct task_group *tg);
+#else
+static inline void free_fair_sched_group(struct task_group *tg) { }
+static inline int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent)
+{
+       return 1;
+}
+static inline void online_fair_sched_group(struct task_group *tg) { }
+static inline void unregister_fair_sched_group(struct task_group *tg) { }
+#endif
+
 extern void init_tg_cfs_entry(struct task_group *tg, struct cfs_rq *cfs_rq,
 			struct sched_entity *se, int cpu,
 			struct sched_entity *parent);
Signature · 1 line
2.39.2
Reviewed-by on v1 5/5
#13 lore raw

Re: [PATCH 5/5] sched: fair: move unused stub functions to header

Quoted 6 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

These four functions have a normal definition for CONFIG_FAIR_GROUP_SCHED, and empty one that is only referenced when FAIR_GROUP_SCHED is disabled but CGROUP_SCHED is still enabled. If both are turned off, the functions are still defined but the misisng prototype causes a W=1 warning:

missing ?

Quoted 11 lines

kernel/sched/fair.c:12544:6: error: no previous prototype for 'free_fair_sched_group' kernel/sched/fair.c:12546:5: error: no previous prototype for 'alloc_fair_sched_group' kernel/sched/fair.c:12553:6: error: no previous prototype for 'online_fair_sched_group' kernel/sched/fair.c:12555:6: error: no previous prototype for 'unregister_fair_sched_group'

Move the alternatives into the header as static inline functions with the correct combination of #ifdef checks to avoid the warning without adding even more complexity.

LGTM.

-- Mukesh

Quoted 55 lines
---
  kernel/sched/fair.c  | 13 -------------
  kernel/sched/sched.h | 11 +++++++++++
  2 files changed, 11 insertions(+), 13 deletions(-)
kernel/sched/fair.c +0 -13
index a7a8ccde3bd7..bae8907c1635 100644
@@ -12602,19 +12602,6 @@ int sched_group_set_idle(struct task_group *tg, long idle)
  	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 */
 
 
kernel/sched/sched.h +11 -0
index d5ac0af1eede..0584fa15ffeb 100644
@@ -453,10 +453,21 @@ static inline int walk_tg_tree(tg_visitor down, tg_visitor up, void *data)
 
  extern int tg_nop(struct task_group *tg, void *data);
 
+#ifdef CONFIG_FAIR_GROUP_SCHED
  extern void free_fair_sched_group(struct task_group *tg);
  extern int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent);
  extern void online_fair_sched_group(struct task_group *tg);
  extern void unregister_fair_sched_group(struct task_group *tg);
+#else
+static inline void free_fair_sched_group(struct task_group *tg) { }
+static inline int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent)
+{
+       return 1;
+}
+static inline void online_fair_sched_group(struct task_group *tg) { }
+static inline void unregister_fair_sched_group(struct task_group *tg) { }
+#endif
+
  extern void init_tg_cfs_entry(struct task_group *tg, struct cfs_rq *cfs_rq,
  			struct sched_entity *se, int cpu,
  			struct sched_entity *parent);
merge bot Applied
#14 lore raw

[tip: sched/core] sched/fair: Move unused stub functions to header

In reply to Arnd Bergmann
The following commit has been merged into the sched/core branch of tip:

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     7aa55f2a5902646a19db89dab9961867724b27b8
Gitweb:        https://git.kernel.org/tip/7aa55f2a5902646a19db89dab9961867724b27b8
Author:        Arnd Bergmann <[email protected]>
AuthorDate:    Mon, 22 May 2023 21:50:21 +02:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Tue, 30 May 2023 22:46:26 +02:00

sched/fair: Move unused stub functions to header

These four functions have a normal definition for CONFIG_FAIR_GROUP_SCHED, and empty one that is only referenced when FAIR_GROUP_SCHED is disabled but CGROUP_SCHED is still enabled. If both are turned off, the functions are still defined but the misisng prototype causes a W=1 warning:

kernel/sched/fair.c:12544:6: error: no previous prototype for 'free_fair_sched_group' kernel/sched/fair.c:12546:5: error: no previous prototype for 'alloc_fair_sched_group' kernel/sched/fair.c:12553:6: error: no previous prototype for 'online_fair_sched_group' kernel/sched/fair.c:12555:6: error: no previous prototype for 'unregister_fair_sched_group'

Move the alternatives into the header as static inline functions with the correct combination of #ifdef checks to avoid the warning without adding even more complexity.

---
 kernel/sched/fair.c  | 6 +++---
 kernel/sched/sched.h | 2 --
 2 files changed, 3 insertions(+), 5 deletions(-)
kernel/sched/fair.c +3 -3
index a7a8ccd..48b6f0c 100644
@@ -684,7 +684,7 @@ struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq)
 /**************************************************************
  * Scheduling class statistics methods:
  */
-#ifdef CONFIG_SMP
+
 int sched_update_scaling(void)
 {
 	unsigned int factor = get_update_sysctl_factor();
@@ -702,7 +702,6 @@ int sched_update_scaling(void)
 	return 0;
 }
 #endif
-#endif
 
 /*
  * delta /= w
@@ -6169,8 +6168,9 @@ static inline int throttled_lb_pair(struct task_group *tg,
 	return 0;
 }
 
-#ifdef CONFIG_FAIR_GROUP_SCHED
 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
 
kernel/sched/sched.h +0 -2
index ce07782..6784462 100644
@@ -1245,7 +1245,6 @@ static inline raw_spinlock_t *__rq_lockp(struct rq *rq)
 
 bool cfs_prio_less(const struct task_struct *a, const struct task_struct *b,
 			bool fi);
-void task_vruntime_update(struct rq *rq, struct task_struct *p, bool in_fi);
 
 /*
  * Helpers to check if the CPU's core cookie matches with the task's cookie
@@ -2377,7 +2376,6 @@ static inline struct cpuidle_state *idle_get_state(struct rq *rq)
 #endif
 
 extern void schedule_idle(void);
-asmlinkage void schedule_user(void);
 
 extern void sysrq_sched_debug_show(void);
 extern void sched_init_granularity(void);
maintainer
#15 lore raw
In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

I sent out a lot of -Wmissing-prototype warnings already, but noticed that I missed some of the patches I did for the scheduler.

Addressing this is mainly useful in order to allow turning the warning on by default in the future, but I also tried to improe the code where possible.

Quoted 7 lines

Arnd Bergmann (5):
sched: hide unused sched_update_scaling()
sched: add schedule_user() declaration
sched: fair: hide unused init_cfs_bandwidth() stub
sched: make task_vruntime_update() prototype visible
sched: fair: move unused stub functions to header

Thanks!

maintainer Reviewed-by on the v1 series
#16 lore raw
In reply to Arnd Bergmann
Quoted 10 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

I sent out a lot of -Wmissing-prototype warnings already, but noticed that I missed some of the patches I did for the scheduler.

Addressing this is mainly useful in order to allow turning the warning on by default in the future, but I also tried to improe the code where possible.

Quoted 6 lines

Arnd Bergmann (5):
sched: hide unused sched_update_scaling()
sched: add schedule_user() declaration
sched: fair: hide unused init_cfs_bandwidth() stub
sched: make task_vruntime_update() prototype visible
sched: fair: move unused stub functions to header

For the whole serie

Quoted 21 lines
 kernel/sched/core.c  |  2 --
 kernel/sched/fair.c  | 19 +++----------------
 kernel/sched/sched.h | 13 +++++++++++++
 3 files changed, 16 insertions(+), 18 deletions(-)

--
2.39.2

Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Juri Lelli <[email protected]>
Cc Vincent Guittot <[email protected]>
Cc Dietmar Eggemann <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Ben Segall <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Daniel Bristot de Oliveira <[email protected]>
Cc Valentin Schneider <[email protected]>