Re: scheduler bigpatch is out

Richard Gooch (rgooch@atnf.csiro.au)
Wed, 21 Oct 1998 08:52:17 +1000


Rik van Riel writes:
> Hi,
>
> this is an announcement for the scheduler bigpatch which
> combines:
> - SCHED_IDLE
> - improved RT latency (Richard's patch)
> - improved interactive performance (my patch)
[...]
> /* Do we need to re-calculate counters? */
> - if (!c) {
> + if (c == 0) {
> struct task_struct *p;
> read_lock(&tasklist_lock);
> - for_each_task(p)
> - p->counter = (p->counter >> 1) + p->priority;
> + p = init_task.next_run;
> + while (p != &init_task) {
> + /* maybe someone added a task, keep the p->counter */
> + p->counter >>= 1;
> + if (p->policy == SCHED_OTHER)
> + p->counter += p->priority;
> + else /* SCHED_IDLE, long slices */
> + p->counter += 499;
> + p = p->next_run;
> + }
> read_unlock(&tasklist_lock);

I'm not keen on this approach. It adds an extra memory load and
test/branch for each process on the run queue. The extra load is the
most damaging, because we hit cache line aliasing problems.
Instead of doing it this way, why not make use of the facility I added
with the RT run queue patch and create another run queue for
idle/batch processes? You would then add a single test/branch
operation after the scan of the SCHED_OTHER run queue to see if you
should scan the SCHED_BATCH (I prefer that name to SCHED_IDLE:-)
queue. Of course, you'd also have to "store" the pointer to the start
of the batch queue just like with the RT and SCHED_OTHER queues.
This has the following advantages:

- no code or memory references added to critical queue scan path

- batch processes are isolated from SCHED_OTHER, which means an
unlimited number of batch processes don't affect normal interactive
scheduling (same argument with RT run queue).

I'd also suggest making the default timeslice for batch processes 1
second.

Regards,

Richard....

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/