* [PATCH 1/2] tty: Abstract tty buffer work
@ 2015-10-17 20:36 Peter Hurley
2015-10-17 20:36 ` [PATCH 2/2] tty: Use unbound workqueue for all input workers Peter Hurley
0 siblings, 1 reply; 3+ messages in thread
From: Peter Hurley @ 2015-10-17 20:36 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Jiri Slaby, linux-kernel, Peter Hurley
Introduce API functions to restart and cancel tty buffer work, rather
than manipulate buffer work directly.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
drivers/tty/n_tty.c | 2 +-
drivers/tty/tty_buffer.c | 10 ++++++++++
drivers/tty/tty_io.c | 2 +-
drivers/tty/tty_port.c | 2 +-
include/linux/tty.h | 2 ++
5 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index fb8ccbf..1384426 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -201,7 +201,7 @@ static void n_tty_kick_worker(struct tty_struct *tty)
*/
WARN_RATELIMIT(test_bit(TTY_LDISC_HALTED, &tty->flags),
"scheduling buffer work for halted ldisc\n");
- queue_work(system_unbound_wq, &tty->port->buf.work);
+ tty_buffer_restart_work(tty->port);
}
}
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index a660ab1..7cc16db 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -587,3 +587,13 @@ void tty_buffer_set_lock_subclass(struct tty_port *port)
{
lockdep_set_subclass(&port->buf.lock, TTY_LOCK_SLAVE);
}
+
+bool tty_buffer_restart_work(struct tty_port *port)
+{
+ return queue_work(system_unbound_wq, &port->buf.work);
+}
+
+bool tty_buffer_cancel_work(struct tty_port *port)
+{
+ return cancel_work_sync(&port->buf.work);
+}
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 173fdeb..0c41dbc 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -1689,7 +1689,7 @@ static void release_tty(struct tty_struct *tty, int idx)
tty->port->itty = NULL;
if (tty->link)
tty->link->port->itty = NULL;
- cancel_work_sync(&tty->port->buf.work);
+ tty_buffer_cancel_work(tty->port);
tty_kref_put(tty->link);
tty_kref_put(tty);
diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
index e04a8cf..482f33f 100644
--- a/drivers/tty/tty_port.c
+++ b/drivers/tty/tty_port.c
@@ -130,7 +130,7 @@ EXPORT_SYMBOL(tty_port_free_xmit_buf);
*/
void tty_port_destroy(struct tty_port *port)
{
- cancel_work_sync(&port->buf.work);
+ tty_buffer_cancel_work(port);
tty_buffer_free_all(port);
}
EXPORT_SYMBOL(tty_port_destroy);
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 533d7f6..5b04b0a 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -467,6 +467,8 @@ extern void tty_buffer_free_all(struct tty_port *port);
extern void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld);
extern void tty_buffer_init(struct tty_port *port);
extern void tty_buffer_set_lock_subclass(struct tty_port *port);
+extern bool tty_buffer_restart_work(struct tty_port *port);
+extern bool tty_buffer_cancel_work(struct tty_port *port);
extern speed_t tty_termios_baud_rate(struct ktermios *termios);
extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
extern void tty_termios_encode_baud_rate(struct ktermios *termios,
--
2.6.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 2/2] tty: Use unbound workqueue for all input workers
2015-10-17 20:36 [PATCH 1/2] tty: Abstract tty buffer work Peter Hurley
@ 2015-10-17 20:36 ` Peter Hurley
2015-10-18 4:32 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Peter Hurley @ 2015-10-17 20:36 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Jiri Slaby, linux-kernel, Peter Hurley
The commonly accepted wisdom that scheduling work on the same cpu
that handled interrupt i/o benefits from cache-locality is only
true if the cpu is idle (since bound kworkers are often the highest
vruntime and thus the lowest priority).
Measurements of scheduling via the unbound queue show lowered
worst-case latency responses of up to 5x over bound workqueue, without
increase in average latency or throughput.
pty i/o test measurements show >3x (!) reduced total running time; tests
previously taking ~8s now complete in <2.5s.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
drivers/tty/tty_buffer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index 7cc16db..9a479e6 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -403,7 +403,7 @@ void tty_schedule_flip(struct tty_port *port)
* flush_to_ldisc() sees buffer data.
*/
smp_store_release(&buf->tail->commit, buf->tail->used);
- schedule_work(&buf->work);
+ queue_work(system_unbound_wq, &buf->work);
}
EXPORT_SYMBOL(tty_schedule_flip);
--
2.6.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] tty: Use unbound workqueue for all input workers
2015-10-17 20:36 ` [PATCH 2/2] tty: Use unbound workqueue for all input workers Peter Hurley
@ 2015-10-18 4:32 ` Greg Kroah-Hartman
0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2015-10-18 4:32 UTC (permalink / raw)
To: Peter Hurley; +Cc: Jiri Slaby, linux-kernel
On Sat, Oct 17, 2015 at 04:36:24PM -0400, Peter Hurley wrote:
> The commonly accepted wisdom that scheduling work on the same cpu
> that handled interrupt i/o benefits from cache-locality is only
> true if the cpu is idle (since bound kworkers are often the highest
> vruntime and thus the lowest priority).
>
> Measurements of scheduling via the unbound queue show lowered
> worst-case latency responses of up to 5x over bound workqueue, without
> increase in average latency or throughput.
>
> pty i/o test measurements show >3x (!) reduced total running time; tests
> previously taking ~8s now complete in <2.5s.
Wow, nice job with this, that's unexpected.
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-10-18 4:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-17 20:36 [PATCH 1/2] tty: Abstract tty buffer work Peter Hurley
2015-10-17 20:36 ` [PATCH 2/2] tty: Use unbound workqueue for all input workers Peter Hurley
2015-10-18 4:32 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox