Re: Where does 10ms serial port read latency come from?

Theodore Y. Ts'o (tytso@mit.edu)
Tue, 20 Oct 1998 13:53:26 -0400


From: alan@lxorguk.ukuu.org.uk (Alan Cox)
Date: Tue, 20 Oct 1998 04:56:27 +0100 (BST)

> I've found nothing relevant in the linux docs, except perhaps for the
> 100Hz kernel scheduling timer, though since there's no process between
> mine and the serial port, i can't see how that matters.

Linux dumps serial line data into buffers and does the line processing
every 100th of a second. For normal use that gives exceptional efficiency,
good scaling and good cache locality while avoiding the scheduler
thrashing between tasks.

On the negative side it screws what you are trying to do rather completely.

This can be turned off in Linux 2.1 (and thus in the upcoming Linux
2.2), by using the ASYNC_LOW_LATENCY option. This has the cost of
increased CPU overhead, as Alan mentioned, but it's useful for people
who need lower latency for real-time applications.

The current version of setserial doesn't yet have support for this flag,
but I'll try to get a new version of setserial released by the end of
this week. (Tim, send me private e-mail if you need something sooner; I
can send you an updated setserial directly, but I want fix some of its
documentation before I push out an official release.)

If you need low-latency behaviour for Linux 2.0, I can send you a kernel
patch which forces the low-latency behaviour for all tty ports. Crude,
but it will do the job.

- Ted

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