Bug 8529 - SCHED_RR policy does not seem to work properly
Summary: SCHED_RR policy does not seem to work properly
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kernel
Version: 6.1
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Michael K. Johnson
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2000-01-17 10:04 UTC by Dmitry Pugachov
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2000-01-17 10:04:37 UTC

Attachments (Terms of Use)

Description Dmitry Pugachov 2000-01-17 10:04:37 UTC
Appearance: tasks with SCHED_RR policy are not preempted by other SCHED_RR
tasks of the same static priority over the time quantum. SCHED_RR works
exactly like SCHED_FIFO.

Possible explanation: looking at the schedule() function, it becomes clear
that although an exhausted SCHED_RR task is moved to be last in the
runqueue, it is chosen to run anyway. Indeed, if prev->state was
TASK_RUNNING (as it is when a task is about to be preempted because its
time quantum has expired), the code at "still_running" will set the
initial search pointer ("next") to the exhausted task itself:

        if (prev->state == TASK_RUNNING)
                goto still_running;
        c = prev_goodness(prev, prev, this_cpu);
        next = prev;
        goto still_running_back;

Thus, the search will start from the exhausted task itself and it will be
chosen to run next, resulting in no preemption.

Possible fix: the above "if" statement, if changed to the following:

        if (prev->policy != SCHED_RR && prev->state == TASK_RUNNING)
                goto still_running;

fixes the problem.

Please, correct me if I'm wrong, but I think that's the way SCHED_RR should

Note You need to log in before you can comment on or make changes to this bug.