Subject: Re: linux-next: build warning after merge of the final tree (tip tree related)

From: Mike Galbraith <[email-masked]>
Date: Thu, 15 Apr 2010 07:29:59 +0200

On Thu, 2010-04-15 at 14:36 +1000, Stephen Rothwell wrote:
> Hi all,
> 
> After merging the final tree, today's linux-next build (powerpc
> allnoconfig) produced this warning:
> 
> kernel/sched.c:1875: warning: 'update_avg' defined but not used
> 
> Introduced by commit e12f31d3e5d36328c7fbd0fce40a95e70b59152c ("sched:
> Remove avg_overlap") which left the only call to this function protected
> by CONFIG_SMP.

Oops.

sched: fix UP update_avg() build warning.

update_avg() is only used for SMP builds, move it to the nearest SMP block.

Signed-off-by: Mike Galbraith <[email-masked]>
Reported-by: Stephen Rothwell <[email-masked]>
Cc: Ingo Molnar <[email-masked]>
Cc: Peter Zijlstra <[email-masked]>
LKML-Reference: <new-submission>

diff --git a/kernel/sched.c b/kernel/sched.c
index 3acf694..95eaecc 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1872,12 +1872,6 @@ static void set_load_weight(struct task_struct *p)
 	p->se.load.inv_weight = prio_to_wmult[p->static_prio - MAX_RT_PRIO];
 }
 
-static void update_avg(u64 *avg, u64 sample)
-{
-	s64 diff = sample - *avg;
-	*avg += diff >> 3;
-}
-
 static void enqueue_task(struct rq *rq, struct task_struct *p, int flags)
 {
 	update_rq_clock(rq);
@@ -2289,6 +2283,12 @@ int select_task_rq(struct rq *rq, struct task_struct *p, int sd_flags, int wake_
 
 	return cpu;
 }
+
+static void update_avg(u64 *avg, u64 sample)
+{
+	s64 diff = sample - *avg;
+	*avg += diff >> 3;
+}
 #endif
 
 /***