]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
sched/deadline: Fix overflow to handle period==0 and deadline!=0
authorSteven Rostedt <rostedt@goodmis.org>
Wed, 19 Feb 2014 18:53:35 +0000 (13:53 -0500)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 21 Feb 2014 20:27:09 +0000 (21:27 +0100)
commit4df1638cfaf9b2b7ad993979a41965acab9cd156
tree054e7a3fe260b5509bb46f12be416fc07e11dcb5
parent3d5f35bdfdef5fd627afe9b4bf9c4f32d17f4593
sched/deadline: Fix overflow to handle period==0 and deadline!=0

While debugging the crash with the bad nr_running accounting, I hit
another bug where, after running my sched deadline test, I was getting
failures to take a CPU offline. It was giving me a -EBUSY error.

Adding a bunch of trace_printk()s around, I found that the cpu
notifier that called sched_cpu_inactive() was returning a failure. The
overflow value was coming up negative?

Talking this over with Juri, the problem is that the total_bw update was
suppose to be made by dl_overflow() which, during my tests, seemed to
not be called. Adding more trace_printk()s, it wasn't that it wasn't
called, but it exited out right away with the check of new_bw being
equal to p->dl.dl_bw. The new_bw calculates the ratio between period and
runtime. The bug is that if you set a deadline, you do not need to set
a period if you plan on the period being equal to the deadline. That
is, if period is zero and deadline is not, then the system call should
set the period to be equal to the deadline. This is done elsewhere in
the code.

The fix is easy, check if period is set, and if it is not, then use the
deadline.

Cc: Juri Lelli <juri.lelli@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20140219135335.7e74abd4@gandalf.local.home
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
kernel/sched/core.c