Commit 66e5393a authored by Steven Rostedt's avatar Steven Rostedt Committed by Linus Torvalds

[PATCH] BUG() if setscheduler is called from interrupt context

Thomas Gleixner is adding the call to a rtmutex function in setscheduler.
This call grabs a spin_lock that is not always protected by interrupts
disabled.  So this means that setscheduler cant be called from interrupt
context.

To prevent this from happening in the future, this patch adds a
BUG_ON(in_interrupt()) in that function.  (Thanks to akpm <aka.  Andrew
Morton> for this suggestion).
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 9fea80e4
...@@ -3862,6 +3862,8 @@ int sched_setscheduler(struct task_struct *p, int policy, ...@@ -3862,6 +3862,8 @@ int sched_setscheduler(struct task_struct *p, int policy,
unsigned long flags; unsigned long flags;
runqueue_t *rq; runqueue_t *rq;
/* may grab non-irq protected spin_locks */
BUG_ON(in_interrupt());
recheck: recheck:
/* double check policy once rq lock held */ /* double check policy once rq lock held */
if (policy < 0) if (policy < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment