diff options
author | Peter Zijlstra <peterz@infradead.org> | 2014-01-27 05:54:13 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-01-28 07:08:41 -0500 |
commit | a57beec5d427086cdc8d75fd51164577193fa7f4 (patch) | |
tree | 86bbff9570824031ec4bd42bfd5dd11e4b825a55 /kernel/sched/core.c | |
parent | 712e5e34aef449ab680b35c0d9016f59b0a4494c (diff) |
sched: Make sched_class::get_rr_interval() optional
Not all classes implement (or can implement) a useful get_rr_interval()
function, default to a 0 time-slice for them.
This fixes a crash reported by Tommi Rantala.
Reported-by: Tommi Rantala <tt.rantala@gmail.com>
Cc: Dave Jones <davej@redhat.com>
Cc: Tommi Rantala <tt.rantala@gmail.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20140127105413.GC11314@laptop.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched/core.c')
-rw-r--r-- | kernel/sched/core.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 36c951b7eef8..81343d6bd9cb 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -4324,7 +4324,9 @@ SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid, | |||
4324 | goto out_unlock; | 4324 | goto out_unlock; |
4325 | 4325 | ||
4326 | rq = task_rq_lock(p, &flags); | 4326 | rq = task_rq_lock(p, &flags); |
4327 | time_slice = p->sched_class->get_rr_interval(rq, p); | 4327 | time_slice = 0; |
4328 | if (p->sched_class->get_rr_interval) | ||
4329 | time_slice = p->sched_class->get_rr_interval(rq, p); | ||
4328 | task_rq_unlock(rq, p, &flags); | 4330 | task_rq_unlock(rq, p, &flags); |
4329 | 4331 | ||
4330 | rcu_read_unlock(); | 4332 | rcu_read_unlock(); |