Commit 2e6fb812 authored by Philippe Gerum's avatar Philippe Gerum Committed by Jan Kiszka
Browse files

cobalt/thread: skip boundary check for infinite round-robin time slice

Disabling round-robin is obtained by passing XN_INFINITE for quantum
to xnthread_set_slice(), which is zero: we don't want to check such
value against the clock gravity.

As a matter of fact, this bug may have prevented the RR mode to be
switched off for years, causing the routine to always fail early with
Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <>
parent e9708b41
...@@ -1471,16 +1471,14 @@ int xnthread_set_slice(struct xnthread *thread, xnticks_t quantum) ...@@ -1471,16 +1471,14 @@ int xnthread_set_slice(struct xnthread *thread, xnticks_t quantum)
struct xnsched *sched; struct xnsched *sched;
spl_t s; spl_t s;
if (quantum <= xnclock_get_gravity(&nkclock, user))
return -EINVAL;
xnlock_get_irqsave(&nklock, s); xnlock_get_irqsave(&nklock, s);
sched = thread->sched; sched = thread->sched;
thread->rrperiod = quantum; thread->rrperiod = quantum;
if (quantum != XN_INFINITE) { if (quantum != XN_INFINITE) {
if (thread->base_class->sched_tick == NULL) { if (quantum <= xnclock_get_gravity(&nkclock, user) ||
thread->base_class->sched_tick == NULL) {
xnlock_put_irqrestore(&nklock, s); xnlock_put_irqrestore(&nklock, s);
return -EINVAL; return -EINVAL;
} }
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