Thread (237 messages) 237 messages, 3 authors, 2013-07-25

Re: [PATCH v2 0/9] mostly lockless tty echo

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: 2013-07-24 00:04:35
Also in: lkml

On Sat, Jun 15, 2013 at 10:04:20AM -0400, Peter Hurley wrote:
** v2 changes **
- Rebased on v2 of 'lockless tty flip buffers'

This 3rd of 4 patchsets implements a mostly-lockless tty echo output.

Because echoing is performed solely by the single-threaded ldisc
receive_buf() method, most of the lockless requirements are already
in-place. The main existing complications were;
1) Echoing could overrun itself. A fixed-size buffer is used to record
   the operations necessary when outputting the echoes; the most recent
   echo data is preserved.
2) An attempt to push unprocessed echoes is made by the n_tty_write method
   (on a different thread) before attempting write output.

The overrun condition is solved by outputting the echoes in blocks and
ensuring that at least that much space is available each time an echo
operation is committed. At the conclusion of each flip buffer received,
any remaining unprocessed echoes are output.

This block output method is particularly effective when there is no reader
(the tty is output-only) and termios is misconfigured with echo enabled.

The concurrent access by the n_tty_write() method is already excluded
by the existing output_lock mutex.
Applied, thanks.

greg k-h
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help