Messages in this thread | | | From | Peter Hurley <> | Subject | [PATCH tty-next 0/5] Halve tty buffer memory consumption | Date | Fri, 22 Nov 2013 12:09:53 -0500 |
| |
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Greg,
This patchset implements a method of encoding tty 'flip' buffers such that storage is not allocated for per-byte-received 'flag' bytes if the data received contains no error.
The N_TTY line discipline already contains logic which assumes that if the flags buffer ptr is NULL, all data is assumed to be TTY_NORMAL.
Patch 1 documents this behavior and fixes line disciplines not already handling this condition. The INPUT maintainer is Cc'd on the N_MOUSE changes. Patch 2 enables the port driver to alter the default 64k limit imposed by the tty_buffer core. Hi-throughput drivers (>10MB/sec) can use this to reduce/eliminate dropped data. A forthcoming fwserial patchset does just this to remove local rx buffering (and 100 lines of code). Patch 3 s/memory_used/mem_used Patch 4 removes the unused tty_prepare_flip_string_flags() function Patch 5 implements the NULL flag buffer encoding scheme.
For each allocated flip buffer, a bitfield is added which is used to differentiate a flip buffer without a flags buffer (in which all data is TTY_NORMAL) from a flip buffer containing 'flagged' data.
If the current flip buffer has no flags field and new 'flagged' data is inserted, the current flip buffer is committed and a new current flip buffer is allocated with a flags buffer.
Users of tty_insert_flip_string_flag() always allocates a flags buffer on the assumption that data is not entirely TTY_NORMAL.
Regards,
Peter Hurley (5): tty: Always handle NULL flag ptr tty: Enable configurable tty flip buffer limit tty: Rename tty buffer memory_used field tty: Remove tty_prepare_flip_string_flags() tty: Halve flip buffer GFP_ATOMIC memory consumption
drivers/input/serio/serport.c | 28 +++++------ drivers/tty/n_gsm.c | 5 +- drivers/tty/n_r3964.c | 2 +- drivers/tty/tty_buffer.c | 105 ++++++++++++++++++++++++------------------ include/linux/tty.h | 7 ++- include/linux/tty_flip.h | 11 +++-- include/linux/tty_ldisc.h | 6 ++- 7 files changed, 96 insertions(+), 68 deletions(-)
-- 1.8.1.2
| |