aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2009-09-19 14:55:44 -0400
committerIngo Molnar <mingo@elte.hu>2009-09-20 14:00:32 -0400
commit89f19f04dc72363d912fd007a399cb10310eff6e (patch)
treedaa64e5de98a668eed4a2ceeb6ca95c478be4053 /kernel/trace/trace.c
parent3f04e8cd5b24727a2500f8ab8f3de730ba47b02c (diff)
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/trace/trace.c')
-rw-r--r--kernel/trace/trace.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index fd52a19dd172..420232a1fbba 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -275,12 +275,18 @@ static DEFINE_SPINLOCK(tracing_start_lock);
275 */ 275 */
276void trace_wake_up(void) 276void trace_wake_up(void)
277{ 277{
278 int cpu;
279
280 if (trace_flags & TRACE_ITER_BLOCK)
281 return;
278 /* 282 /*
279 * The runqueue_is_locked() can fail, but this is the best we 283 * The runqueue_is_locked() can fail, but this is the best we
280 * have for now: 284 * have for now:
281 */ 285 */
282 if (!(trace_flags & TRACE_ITER_BLOCK) && !runqueue_is_locked()) 286 cpu = get_cpu();
287 if (!runqueue_is_locked(cpu))
283 wake_up(&trace_wait); 288 wake_up(&trace_wait);
289 put_cpu();
284} 290}
285 291
286static int __init set_buf_size(char *str) 292static int __init set_buf_size(char *str)