diff options
author | Ivo Sieben <meltedpianoman@gmail.com> | 2012-09-27 08:02:05 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-22 19:47:51 -0400 |
commit | cee4ad1ed90a0959fc29f9d30a2526e5e9522cfa (patch) | |
tree | 32b33be64fb490a9f7d3c704dea0a44ea3138ca6 | |
parent | daee779718a319ff9f83e1ba3339334ac650bb22 (diff) |
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: Ivo Sieben <meltedpianoman@gmail.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/tty_buffer.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index 91e326ffe7db..8b00f6a34a7d 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c | |||
@@ -342,6 +342,8 @@ EXPORT_SYMBOL(tty_insert_flip_string_flags); | |||
342 | * Takes any pending buffers and transfers their ownership to the | 342 | * Takes any pending buffers and transfers their ownership to the |
343 | * ldisc side of the queue. It then schedules those characters for | 343 | * ldisc side of the queue. It then schedules those characters for |
344 | * processing by the line discipline. | 344 | * processing by the line discipline. |
345 | * Note that this function can only be used when the low_latency flag | ||
346 | * is unset. Otherwise the workqueue won't be flushed. | ||
345 | * | 347 | * |
346 | * Locking: Takes tty->buf.lock | 348 | * Locking: Takes tty->buf.lock |
347 | */ | 349 | */ |
@@ -514,7 +516,8 @@ static void flush_to_ldisc(struct work_struct *work) | |||
514 | */ | 516 | */ |
515 | void tty_flush_to_ldisc(struct tty_struct *tty) | 517 | void tty_flush_to_ldisc(struct tty_struct *tty) |
516 | { | 518 | { |
517 | flush_work(&tty->buf.work); | 519 | if (!tty->low_latency) |
520 | flush_work(&tty->buf.work); | ||
518 | } | 521 | } |
519 | 522 | ||
520 | /** | 523 | /** |