[patch 0/8] New RT Task Balancing

Previous thread: [patch 6/8] pull RT tasks by Steven Rostedt on Friday, October 19, 2007 - 2:43 pm. (10 messages)

Next thread: [patch 5/8] Move prototypes together. by Steven Rostedt on Friday, October 19, 2007 - 2:42 pm. (1 message)
To: LKML <linux-kernel@...>, RT <linux-rt-users@...>
Cc: Linus Torvalds <torvalds@...>, Andrew Morton <akpm@...>, Ingo Molnar <mingo@...>, Thomas Gleixner <tglx@...>, Gregory Haskins <ghaskins@...>, Peter Zijlstra <a.p.zijlstra@...>
Date: Friday, October 19, 2007 - 2:42 pm

Currently in mainline the balancing of multiple RT threads is quite broken.
That is to say that a high priority thread that is scheduled on a CPU
with a higher priority thread, may need to unnecessarily wait while it
can easily run on another CPU that's running a lower priority thread.

Balancing (or migrating) tasks in general is an art. Lots of considerations
must be taken into account. Cache lines, NUMA and more. This is true
with general processes which expect high through put and migration can
be done in batch. But when it comes to RT tasks, we really need to
put them off to a CPU that they can run on as soon as possible. Even
if it means a bit of cache line flushing.

Right now an RT task can wait several milliseconds before it gets scheduled
to run. And perhaps even longer. The migration thread is not fast enough
to take care of RT tasks.

To demonstrate this, I wrote a simple test.

http://rostedt.homelinux.com/rt/rt-migrate-test.c

(gcc -o rt-migrate-test rt-migrate-test.c -lpthread)

This test expects a parameter to pass in the number of threads to create.
If you add the '-c' option (check) it will terminate if the test fails
one of the iterations. If you add this, pass in +1 threads.

For example, on a 4 way box, I used

rt-migrate-test -c 5

What this test does is to create the number of threads specified (in this
case 5). Each thread is set as an RT FIFO task starting at a specified
prio (default 2) and each thread being one priority higher. So with this
example the 5 threads created are at priorities 2, 3, 4, 5, and 6.

The parent thread sets its priority to one higher than the highest of
the children (this example 7). It uses pthread_barrier_wait to synchronize
the threads. Then it takes a time stamp and starts all the threads.
The threads when woken up take a time stamp and compares it to the parent
thread to see how long it took to be awoken. It then runs for an
interval (20ms default) in a busy loop. The busy loop ends when it reaches
the inter...

Previous thread: [patch 6/8] pull RT tasks by Steven Rostedt on Friday, October 19, 2007 - 2:43 pm. (10 messages)

Next thread: [patch 5/8] Move prototypes together. by Steven Rostedt on Friday, October 19, 2007 - 2:42 pm. (1 message)