Bug 8529 - SCHED_RR policy does not seem to work properly
SCHED_RR policy does not seem to work properly
Product: Red Hat Linux
Classification: Retired
Component: kernel (Show other bugs)
i386 Linux
medium Severity high
: ---
: ---
Assigned To: Michael K. Johnson
Depends On:
  Show dependency treegraph
Reported: 2000-01-17 05:04 EST by Dmitry Pugachov
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2000-01-17 05:04:37 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Dmitry Pugachov 2000-01-17 05:04:37 EST
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.