Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1370721 > unrolled thread

[PATCH v10 2/2] printk: Make wake_up_klogd_work_func() async

Started bySergey Senozhatsky <sergey.senozhatsky@gmail.com>
First post2016-04-04 18:10 +0200
Last post2016-04-04 18:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v10 2/2] printk: Make wake_up_klogd_work_func() async Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-04-04 18:10 +0200

#1370721 — [PATCH v10 2/2] printk: Make wake_up_klogd_work_func() async

FromSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Date2016-04-04 18:10 +0200
Subject[PATCH v10 2/2] printk: Make wake_up_klogd_work_func() async
Message-ID<rkfeF-5Fz-7@gated-at.bofh.it>
From: Jan Kara <jack@suse.cz>

Offload printing of scheduler deferred messages from IRQ context
to a schedulable printing kthread, when possible (the same way we
do it in vprintk_emit()). Otherwise, the CPU can spend unbounded
amount of time doing printing in console_unlock() from IRQ.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
---
 kernel/printk/printk.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index f63dfe4..c364f18 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2808,9 +2808,16 @@ static void wake_up_klogd_work_func(struct irq_work *irq_work)
 	int pending = __this_cpu_xchg(printk_pending, 0);
 
 	if (pending & PRINTK_PENDING_OUTPUT) {
-		/* If trylock fails, someone else is doing the printing */
-		if (console_trylock())
-			console_unlock();
+		if (printk_kthread) {
+			wake_up_process(printk_kthread);
+		} else {
+			/*
+			 * If trylock fails, someone else is doing
+			 * the printing
+			 */
+			if (console_trylock())
+				console_unlock();
+		}
 	}
 
 	if (pending & PRINTK_PENDING_WAKEUP)
-- 
2.8.0

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web