[PATCH 2/2] sched: fair: Fix "declared 'static' but never defined" warning

From: Fabio Estevam
Date: Fri Oct 05 2012 - 15:50:08 EST


commit 4ae834f767 (sched/numa: Implement NUMA home-node selection code)
caused the following warning on a !CONFIG_SMP system:

kernel/sched/fair.c:801:22: warning: 'task_h_load' declared 'static' but never defined [-Wunused-function]

Instead of doing the forward declaration of task_h_load(), declare it sooner to avoid
the warning in the !CONFIG_SMP case.

Signed-off-by: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx>
---
kernel/sched/fair.c | 36 +++++++++++++++++++-----------------
1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index b75a336..d57b5fd 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -798,7 +798,25 @@ update_stats_curr_start(struct cfs_rq *cfs_rq, struct sched_entity *se)
* information we have.
*/

-static unsigned long task_h_load(struct task_struct *p);
+#ifdef CONFIG_SMP
+#ifdef CONFIG_FAIR_GROUP_SCHED
+static unsigned long task_h_load(struct task_struct *p)
+{
+ struct cfs_rq *cfs_rq = task_cfs_rq(p);
+ unsigned long load;
+
+ load = p->se.load.weight;
+ load = div_u64(load * cfs_rq->h_load, cfs_rq->load.weight + 1);
+
+ return load;
+}
+#else
+static unsigned long task_h_load(struct task_struct *p)
+{
+ return p->se.load.weight;
+}
+#endif /* CONFIG_FAIR_GROUP_SCHED */
+#endif /* CONFIG_SMP */

#ifdef CONFIG_SCHED_NUMA
#ifdef CONFIG_SMP
@@ -3757,17 +3775,6 @@ static void update_h_load(long cpu)
walk_tg_tree(tg_load_down, tg_nop, (void *)cpu);
rcu_read_unlock();
}
-
-static unsigned long task_h_load(struct task_struct *p)
-{
- struct cfs_rq *cfs_rq = task_cfs_rq(p);
- unsigned long load;
-
- load = p->se.load.weight;
- load = div_u64(load * cfs_rq->h_load, cfs_rq->load.weight + 1);
-
- return load;
-}
#else
static inline void update_shares(int cpu)
{
@@ -3776,11 +3783,6 @@ static inline void update_shares(int cpu)
static inline void update_h_load(long cpu)
{
}
-
-static unsigned long task_h_load(struct task_struct *p)
-{
- return p->se.load.weight;
-}
#endif

/********** Helpers for find_busiest_group ************************/
--
1.7.9.5


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/