[tip: sched/rt] printk: nbcon: Assign nice -20 for printing threads

tip-bot2 for John Ogness posted 1 patch 2 months, 3 weeks ago
kernel/printk/nbcon.c  | 6 ++++++
kernel/printk/printk.c | 6 ++++++
2 files changed, 12 insertions(+)
[tip: sched/rt] printk: nbcon: Assign nice -20 for printing threads
Posted by tip-bot2 for John Ogness 2 months, 3 weeks ago
The following commit has been merged into the sched/rt branch of tip:

Commit-ID:     1529bbb6e2619495f146dd519a196b67837fdfa6
Gitweb:        https://git.kernel.org/tip/1529bbb6e2619495f146dd519a196b67837fdfa6
Author:        John Ogness <john.ogness@linutronix.de>
AuthorDate:    Wed, 04 Sep 2024 14:11:35 +02:06
Committer:     Petr Mladek <pmladek@suse.com>
CommitterDate: Wed, 04 Sep 2024 15:56:33 +02:00

printk: nbcon: Assign nice -20 for printing threads

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@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20240904120536.115780-17-john.ogness@linutronix.de
Signed-off-by: Petr Mladek <pmladek@suse.com>
---
 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 9844088..fd12efc 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 66cfe7b..afd9266 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;
 }