Re: TTY_FLIPBUF_SIZE too low causing dataloss on too fast serial lines?

Theodore Y. Ts'o (tytso@MIT.EDU)
Fri, 28 May 1999 17:32:33 -0400 (EDT)


Date: Thu, 27 May 1999 00:15:03 +0200
From: Pavel Machek <pavel@bug.ucw.cz>

On short cable, for notebook-to-notebook data transfer, it seems very
practical to me. [serial cables are much more common than 10mbit
pcmcia cards.]

It depends on your environment, I suspect; in the circles which I
frequent, ethernet cables and pcmcia cards are far more commonly carried
around in one's laptop bags than serial cables.

> interesting applications requiring that yet. I do intend to fix this; I
> just haven't seen a huge urgency to it. If someone has an actual,

Is there some easy way for me to make it work 'just now'? Like calling
tty_flip_buffer_push from some kind of bh or increasing hz to 1000 or
...?

Well, you could set tty->low_latency and then call
tty_flip_buffer_push(), which will force it out to the line discpline
right away. Increasaing HZ to 1000 is also a possibility.

Why is size of struct tty limited to PAGE_SIZE in the first place?

Struct tty was done in the days where we didn't have wonderfully
efficient allocators. So struct tty is allocated using get_free_page().
Back then I was also trying to make sure the driver was reasonably
memory efficient, so that's why the flip buffer is stored a part of
struct tty instead of being a separately allocated piece of dynamic
memory.

If I were to change things now, I would not make struct tty bigger than
PAGE_SIZE; even now, it's best if you avoid trying to allocate objects
bigger than a page if you can help it. Instead, I'd make the flip
buffer allocated separately from the tty structure, and make it up to
the device driver what a proper size for the flip buffer ought to be.
That way we don't have to waste a lot of memory if a device *knows* that
it's only doing low-speed transfers that don't need a lot of flip buffer
space.

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