NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/38751: sched_rr_get_interval() doesn't tell the truth



>Number:         38751
>Category:       kern
>Synopsis:       sched_rr_get_interval() doesn't tell the truth
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun May 25 22:35:00 +0000 2008
>Originator:     Andrew Doran
>Release:        4.99.63
>Organization:
The NetBSD Project
>Environment:
n/a
>Description:
sched_rr_get_interval leans on sysconf:

int
sched_rr_get_interval(pid_t pid, struct timespec *interval)
{

        interval->tv_sec = 0;
        interval->tv_nsec = sysconf(_SC_SCHED_RT_TS) * 1000;
        return 0;
}
...
        case _SC_SCHED_RT_TS:
                if (sysctlgetmibinfo("kern.sched.rtts", ....

On my system:

$ sysctl kern.sched.rtts
kern.sched.rtts = 100

So we appear to be reporting timeslices of 100us, when the real
figure is probably closer to 62500us, because the preemption is
driven by sched_tick().

>How-To-Repeat:
Code inspection.
>Fix:
- Preempt SCHED_RR threads on every hardclock() tick.
- Ensure that we report the correct value to applications.




Home | Main Index | Thread Index | Old Index