[PATCH printk v6 16/17] printk: nbcon: Assign nice -20 for printing threads

From: John Ogness
Date: Wed Sep 04 2024 - 08:12:48 EST


It is important that console printing threads are scheduled
shortly after a printk call and with generous runtime budgets.

Signed-off-by: John Ogness <john.ogness@xxxxxxxxxxxxx>
Reviewed-by: Petr Mladek <pmladek@xxxxxxxx>
---
kernel/printk/nbcon.c | 6 ++++++
kernel/printk/printk.c | 6 ++++++
2 files changed, 12 insertions(+)

diff --git a/kernel/printk/nbcon.c b/kernel/printk/nbcon.c
index 98440889d222..fd12efcc4aed 100644
--- a/kernel/printk/nbcon.c
+++ b/kernel/printk/nbcon.c
@@ -1321,6 +1321,12 @@ bool nbcon_kthread_create(struct console *con)

con->kthread = kt;

+ /*
+ * It is important that console printing threads are scheduled
+ * shortly after a printk call and with generous runtime budgets.
+ */
+ sched_set_normal(con->kthread, -20);
+
return true;
}

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 66cfe7b8f95c..afd926611f0f 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -3555,6 +3555,12 @@ static bool legacy_kthread_create(void)

printk_legacy_kthread = kt;

+ /*
+ * It is important that console printing threads are scheduled
+ * shortly after a printk call and with generous runtime budgets.
+ */
+ sched_set_normal(printk_legacy_kthread, -20);
+
return true;
}

--
2.39.2