summaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2009-09-19 11:55:44 -0700
committerIngo Molnar <mingo@elte.hu>2009-09-20 20:00:32 +0200
commit89f19f04dc72363d912fd007a399cb10310eff6e (patch)
treedaa64e5de98a668eed4a2ceeb6ca95c478be4053 /kernel/sched.c
parent3f04e8cd5b24727a2500f8ab8f3de730ba47b02c (diff)
downloadop-kernel-dev-89f19f04dc72363d912fd007a399cb10310eff6e.zip
op-kernel-dev-89f19f04dc72363d912fd007a399cb10310eff6e.tar.gz
sched: Fix raciness in runqueue_is_locked()
runqueue_is_locked() is unavoidably racy due to a poor interface design. It does cpu = get_cpu() ret = some_perpcu_thing(cpu); put_cpu(cpu); return ret; Its return value is unreliable. Fix. Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Steven Rostedt <rostedt@goodmis.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <200909191855.n8JItiko022148@imap1.linux-foundation.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index faf4d46..575fb01 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -681,15 +681,9 @@ inline void update_rq_clock(struct rq *rq)
* This interface allows printk to be called with the runqueue lock
* held and know whether or not it is OK to wake up the klogd.
*/
-int runqueue_is_locked(void)
+int runqueue_is_locked(int cpu)
{
- int cpu = get_cpu();
- struct rq *rq = cpu_rq(cpu);
- int ret;
-
- ret = spin_is_locked(&rq->lock);
- put_cpu();
- return ret;
+ return spin_is_locked(&cpu_rq(cpu)->lock);
}
/*
OpenPOWER on IntegriCloud