Bug 8529 - SCHED_RR policy does not seem to work properly
Summary: SCHED_RR policy does not seem to work properly
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kernel   
(Show other bugs)
Version: 6.1
Hardware: i386
OS: Linux
medium
high
Target Milestone: ---
Assignee: Michael K. Johnson
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
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:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-01-17 10:04:37 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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;
	..........
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
work.


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