Commit cee4ad1e authored by Ivo Sieben's avatar Ivo Sieben Committed by Greg Kroah-Hartman

tty: prevent unnecessary work queue lock checking on flip buffer copy

When low_latency flag is set the TTY receive flip buffer is copied to the
line discipline directly instead of using a work queue in the background.
Therefor only in case a workqueue is actually used for copying data to the
line discipline we'll have to flush the workqueue.

This prevents unnecessary spin lock/unlock on the workqueue spin lock that
can cause additional scheduling overhead on a PREEMPT_RT system. On a 200
MHz AT91SAM9261 processor setup this fixes about 100us of scheduling
overhead on the TTY read call.
Signed-off-by: default avatarIvo Sieben <meltedpianoman@gmail.com>
Acked-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent daee7797
...@@ -342,6 +342,8 @@ EXPORT_SYMBOL(tty_insert_flip_string_flags); ...@@ -342,6 +342,8 @@ EXPORT_SYMBOL(tty_insert_flip_string_flags);
* Takes any pending buffers and transfers their ownership to the * Takes any pending buffers and transfers their ownership to the
* ldisc side of the queue. It then schedules those characters for * ldisc side of the queue. It then schedules those characters for
* processing by the line discipline. * processing by the line discipline.
* Note that this function can only be used when the low_latency flag
* is unset. Otherwise the workqueue won't be flushed.
* *
* Locking: Takes tty->buf.lock * Locking: Takes tty->buf.lock
*/ */
...@@ -514,6 +516,7 @@ static void flush_to_ldisc(struct work_struct *work) ...@@ -514,6 +516,7 @@ static void flush_to_ldisc(struct work_struct *work)
*/ */
void tty_flush_to_ldisc(struct tty_struct *tty) void tty_flush_to_ldisc(struct tty_struct *tty)
{ {
if (!tty->low_latency)
flush_work(&tty->buf.work); flush_work(&tty->buf.work);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment