[PATCH v2] sched: fix unused variable warning when !CONFIG_SMP

From: Baruch Siach
Date: Mon Feb 08 2010 - 02:01:46 EST


This variable was introduced by fabf318e. Now actually tested.

Signed-off-by: Baruch Siach <baruch@xxxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
---
kernel/sched.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 3a8fb30..faf7021 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2647,9 +2647,10 @@ void wake_up_new_task(struct task_struct *p, unsigned long clone_flags)
{
unsigned long flags;
struct rq *rq;
- int cpu = get_cpu();

#ifdef CONFIG_SMP
+ get_cpu();
+
/*
* Fork balancing, do it here and not earlier because:
* - cpus_allowed can change in the fork path
@@ -2659,8 +2660,7 @@ void wake_up_new_task(struct task_struct *p, unsigned long clone_flags)
* ->cpus_allowed is stable, we have preemption disabled, meaning
* cpu_online_mask is stable.
*/
- cpu = select_task_rq(p, SD_BALANCE_FORK, 0);
- set_task_cpu(p, cpu);
+ set_task_cpu(p, select_task_rq(p, SD_BALANCE_FORK, 0));
#endif

rq = task_rq_lock(p, &flags);
@@ -2675,7 +2675,9 @@ void wake_up_new_task(struct task_struct *p, unsigned long clone_flags)
p->sched_class->task_woken(rq, p);
#endif
task_rq_unlock(rq, &flags);
+#ifdef CONFIG_SMP
put_cpu();
+#endif
}

#ifdef CONFIG_PREEMPT_NOTIFIERS
--
1.6.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/