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


Groups > linux.kernel > #1191795 > unrolled thread

[PATCH] modules: don't print out loaded modules too often if nothing changed

Started byKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
First post2015-07-24 15:00 +0200
Last post2015-07-24 15:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] modules: don't print out loaded modules too often if  nothing changed Konstantin Khlebnikov <khlebnikov@yandex-team.ru> - 2015-07-24 15:00 +0200

#1191795 — [PATCH] modules: don't print out loaded modules too often if nothing changed

FromKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
Date2015-07-24 15:00 +0200
Subject[PATCH] modules: don't print out loaded modules too often if nothing changed
Message-ID<pPKJX-6e8-1@gated-at.bofh.it>
List of loaded modules is useful but printing it at each splat
adds too much noise. This patch prints place-holder "<unchanged>"
if kernel not in panic, nothing have changed and since last print
passed less then 15 minutes. First warning will have it for sure.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
---
 kernel/module.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/kernel/module.c b/kernel/module.c
index 4d2b82e610e2..e185b8d53205 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -101,6 +101,7 @@
 DEFINE_MUTEX(module_mutex);
 EXPORT_SYMBOL_GPL(module_mutex);
 static LIST_HEAD(modules);
+static unsigned long modules_printed;
 
 #ifdef CONFIG_MODULES_TREE_LOOKUP
 
@@ -1005,6 +1006,7 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
 
 	/* Store the name of the last unloaded module for diagnostic purposes */
 	strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module));
+	modules_printed = 0;
 
 	free_module(mod);
 	return 0;
@@ -2019,6 +2021,7 @@ static void free_module(struct module *mod)
 	/* Unlink carefully: kallsyms could be walking list. */
 	list_del_rcu(&mod->list);
 	mod_tree_remove(mod);
+	modules_printed = 0;
 	/* Remove this module from bug list, this uses list_del_rcu */
 	module_bug_cleanup(mod);
 	/* Wait for RCU-sched synchronizing before releasing mod->list and buglist. */
@@ -3343,6 +3346,7 @@ again:
 	mod_update_bounds(mod);
 	list_add_rcu(&mod->list, &modules);
 	mod_tree_insert(mod);
+	modules_printed = 0;
 	err = 0;
 
 out:
@@ -3558,6 +3562,7 @@ static int load_module(struct load_info *info, const char __user *uargs,
 	/* Unlink carefully: kallsyms could be walking list. */
 	list_del_rcu(&mod->list);
 	mod_tree_remove(mod);
+	modules_printed = 0;
 	wake_up_all(&module_wq);
 	/* Wait for RCU-sched synchronizing before releasing mod->list. */
 	synchronize_sched();
@@ -4058,6 +4063,14 @@ void print_modules(void)
 	char buf[8];
 
 	printk(KERN_DEFAULT "Modules linked in:");
+
+	if (!oops_in_progress && modules_printed &&
+	    time_before(jiffies, modules_printed + HZ * 60 * 15)) {
+		pr_cont(" <unchanged>\n");
+		return;
+	}
+	modules_printed = jiffies;
+
 	/* Most callers should already have preempt disabled, but make sure */
 	preempt_disable();
 	list_for_each_entry_rcu(mod, &modules, list) {

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web