2019-03-11 08:25:13

by Alexander Sverdlin

[permalink] [raw]
Subject: Re: [PATCH v1 3/3] drivers/tty: increase priority for tty_buffer_worker

Hello Oleksij,

On Thu, 10 Jan 2019 11:12:32 +0100
Oleksij Rempel <[email protected]> wrote:

> sched_priority = 1 is enough to dramatically reduce latency
> on have system load produced by tasks with default user space prio.
>
> Signed-off-by: Oleksij Rempel <[email protected]>

Tested-by: Alexander Sverdlin <[email protected]>

> ---
> drivers/tty/tty_buffer.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
> index 18bd7f48a319..7cf42f6570a0 100644
> --- a/drivers/tty/tty_buffer.c
> +++ b/drivers/tty/tty_buffer.c
> @@ -13,11 +13,13 @@
> #include <linux/string.h>
> #include <linux/slab.h>
> #include <linux/sched.h>
> +#include <linux/sched/rt.h>
> #include <linux/wait.h>
> #include <linux/bitops.h>
> #include <linux/delay.h>
> #include <linux/module.h>
> #include <linux/ratelimit.h>
> +#include <uapi/linux/sched/types.h>
>
>
> #define MIN_TTYB_SIZE 256
> @@ -567,7 +569,15 @@ bool tty_buffer_queue_work(struct tty_port *port)
>
> void tty_buffer_init_kthread(void)
> {
> - kthread_run(kthread_worker_fn, &tty_buffer_worker, "tty");
> + struct sched_param param = { .sched_priority = 1 };
> + struct task_struct *kworker_task;
> +
> + kworker_task = kthread_run(kthread_worker_fn, &tty_buffer_worker, "tty");
> + if (IS_ERR(kworker_task)) {
> + pr_err("failed to create message pump task\n");
> + return;
> + }
> + sched_setscheduler(kworker_task, SCHED_FIFO, &param);
> }
>
> /**


--
Alexander Sverdlin.