tty: Track flip buffer memory limit atomically

Lockless flip buffers require atomically updating the bytes-in-use
watermark.

The pty driver also peeks at the watermark value to limit
memory consumption to a much lower value than the default; query
the watermark with new fn, tty_buffer_space_avail().

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-06-15 09:36:08 -04:00
committed by Greg Kroah-Hartman
parent 7391ee1695
commit 7bfe0b7116
4 changed files with 36 additions and 15 deletions
+1 -2
View File
@@ -71,8 +71,7 @@ struct tty_bufhead {
struct tty_buffer *head; /* Queue head */
struct tty_buffer *tail; /* Active buffer */
struct llist_head free; /* Free queue head */
int memory_used; /* Buffer space used excluding
free queue */
atomic_t memory_used; /* In-use buffers excluding free list */
};
/*
* When a break, frame error, or parity error happens, these codes are