[RFC][PATCHv3 3/5] printk: add enforce_emergency parameter
From: Sergey Senozhatsky
Date: Tue May 09 2017 - 04:30:21 EST
This param permits user-space to forcibly on/off printk emergency
mode via /sys/module/printk/parameters/enforce_emergency node.
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx>
---
kernel/printk/printk.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index a113f684066c..ba640fbcee7c 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -455,9 +455,15 @@ static struct task_struct *printk_kthread __read_mostly;
static atomic_t printk_emergency __read_mostly;
/*
* Disable printk_kthread permanently. Unlike `oops_in_progress'
- * it doesn't go back to 0.
+ * it doesn't go back to 0 (unless set by user-space).
*/
static bool printk_enforce_emergency __read_mostly;
+
+module_param_named(enforce_emergency, printk_enforce_emergency,
+ bool, 0644);
+MODULE_PARM_DESC(printk_enforce_emergency,
+ "don't offload message printing to printk kthread");
+
/*
* The number of lines a task can print before offloading printing
* job to printk_kthread. 0 indicates 'no limit'.
--
2.12.2