Question: How to force the scheduler to run after an interrupt.

gokhan sozmen (gokhan_sozmen@hotbot.com)
Sun, 29 Aug 1999 11:47:23 -0700


Folks,

I have a problem that manifests itself with SMP
kernels ( tried both 2.2.5 and 2.2.11 ).

I am working on a device driver that generates
an interrupt when data is available. In my interrupt
handler I call queue_task to place a task in the
tq_scheduler queue because I want the processing
to take place outside the context of an interrupt
handler. With the UP kernel this scheme works
fine, unfortunately with the SMP kernel if there's
no I/O going on, the scheduler does not get run as
frequently as I would wish ( runs at about every
10 ticks which is too slow for me) and hence my processing grinds down to unacceptable levels.
It's funny because I can get this thing to run
faster by moving my mouse around, the faster I
move it the faster the processing :-)
Maybe I need a crank on the side of my box. :-)

Well here's my question:
Can you tickle the scheduler to run immediately
and can you pull this trick from an interrupt
handler?

Things that won't work:
- Calling schedule() from the interrupt handler.
- Starting a new task at system initialization
using the task_queue mechanism that gets run once
and waits on a wait queue loop for a wake_up from
the interrupt handler. It appears that a task queue
task is not allowed to sleep on a wait queue.
(This is assuming that the scheduler will run
if there's something on a wait queue and someone
wakes it up).
- Changing the value of HZ. Not unless you tell
me a way of doing this without recompiling the
kernel.

One possible solution would have been to start a
kernel thread that waits on a wait queue loop.
I guess you don't have kernel threads in Linux
(or do you?) so that's out.

You could also start a user thread that calls
a special ioctl that sleeps on a wait queue that
gets woken by the interrupt handler but that's
a really ugly hack.

Any ideas?

Thanks in advance.
Gokhan Sozmen

HotBot - Search smarter.
http://www.hotbot.com

-
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/