wake_up() from interrupt - on the next jiffie?

From: gl
Date: Mon Jul 04 2005 - 09:19:02 EST


Hi

This might well be my basic misunderstanding, or the test was wrong, but
the probability is pretty low, so, asking here.

I thought, if a task sleeps on, say, read() and then data come and there's
no other runnable task with a higher priority, the sleeping task should be
woken up immediately. My test showed that the task is only woken up on the
next jiffie. Kernel 2.6.11.10.

Details: a program does a cfmakeraw() on a ttyS, and does blocking reads
of 1 byte in a loop, taking timestamps with gettimeofday() after waking
up. The FIFO is switched off by configuring the UART as 16550. With a low
(e.g., 600 baud) baudrate I see indeed that the task gets individual bytes
as they arrive. However, if I set the baudrate to, say, 19200 the task is
woken up every millisecond (ix86) and then it gets 2 bytes.

Another program, opening 2 pipes, forking, and then playing ping-pong
between the 2 tasks confirms, that in this case the tasks currently
sleeping on read() is woken up immediately as the other one does a
write...

Test program sources available on request.

Is it a conscious decision or is my test wrong?
Thanks
Guennadi
---------------------------------
Guennadi Liakhovetski, Ph.D.
DSA Daten- und Systemtechnik GmbH
Pascalstr. 28
D-52076 Aachen
Germany
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/