Skip to content

Commit

Permalink
[PATCH] BUG() if setscheduler is called from interrupt context
Browse files Browse the repository at this point in the history
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: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Steven Rostedt authored and Linus Torvalds committed Jun 28, 2006
1 parent 9fea80e commit 66e5393
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -3862,6 +3862,8 @@ int sched_setscheduler(struct task_struct *p, int policy,
unsigned long flags;
runqueue_t *rq;

/* may grab non-irq protected spin_locks */
BUG_ON(in_interrupt());
recheck:
/* double check policy once rq lock held */
if (policy < 0)
Expand Down

0 comments on commit 66e5393

Please sign in to comment.