tty: Halve flip buffer GFP_ATOMIC memory consumption

tty flip buffers use GFP_ATOMIC allocations for received data
which is to be processed by the line discipline. For each byte
received, an extra byte is used to indicate the error status of
that byte.

Instead, if the received data is error-free, encode the entire
buffer without status bytes.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Peter Hurley 2013-12-09 09:23:52 -05:00 committed by Greg Kroah-Hartman
parent 9bbc3dca9d
commit acc0f67f30
3 changed files with 45 additions and 12 deletions

View file

@ -39,10 +39,14 @@ struct tty_buffer {
int size;
int commit;
int read;
int flags;
/* Data points here */
unsigned long data[0];
};
/* Values for .flags field of tty_buffer */
#define TTYB_NORMAL 1 /* buffer has no flags buffer */
static inline unsigned char *char_buf_ptr(struct tty_buffer *b, int ofs)
{
return ((unsigned char *)b->data) + ofs;