public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Add for_each_module iterator function
@ 2010-09-22 10:08 Andi Kleen
  2010-09-22 10:08 ` [PATCH 2/2] Rewrite jump_label.c to use binary search Andi Kleen
  2010-09-22 12:25 ` [PATCH 1/2] Add for_each_module iterator function Thomas Gleixner
  0 siblings, 2 replies; 21+ messages in thread
From: Andi Kleen @ 2010-09-22 10:08 UTC (permalink / raw)
  To: jbaron
  Cc: rostedt, linux-kernel, mingo, mathieu.desnoyers, hpa, tglx,
	roland, rth, mhiramat, fweisbec, avi, davem, vgoyal, sam, tony,
	Andi Kleen

From: Andi Kleen <ak@linux.intel.com>

This is a generic function to iterate over all modules.
To be used in the next patch.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 include/linux/module.h |    1 +
 kernel/module.c        |   10 ++++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/include/linux/module.h b/include/linux/module.h
index 403ac26..809b6db 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -410,6 +410,7 @@ struct module *__module_address(unsigned long addr);
 bool is_module_address(unsigned long addr);
 bool is_module_percpu_address(unsigned long addr);
 bool is_module_text_address(unsigned long addr);
+void for_each_module(void (*op)(struct module *, void *arg), void *arg);
 
 static inline int within_module_core(unsigned long addr, struct module *mod)
 {
diff --git a/kernel/module.c b/kernel/module.c
index eba1341..b8fb3e6 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -384,6 +384,16 @@ struct module *find_module(const char *name)
 }
 EXPORT_SYMBOL_GPL(find_module);
 
+void for_each_module(void (*op)(struct module *, void *arg), void *arg)
+{
+	struct module *mod;
+
+	preempt_disable();
+	list_for_each_entry_rcu(mod, &modules, list)
+		op(mod, arg);
+	preempt_enable();
+}
+
 #ifdef CONFIG_SMP
 
 static inline void __percpu *mod_percpu(struct module *mod)
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2010-09-22 20:55 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-22 10:08 [PATCH 1/2] Add for_each_module iterator function Andi Kleen
2010-09-22 10:08 ` [PATCH 2/2] Rewrite jump_label.c to use binary search Andi Kleen
2010-09-22 11:31   ` Mathieu Desnoyers
2010-09-22 11:56     ` Andi Kleen
2010-09-22 12:04       ` Andi Kleen
2010-09-22 15:02         ` Mathieu Desnoyers
2010-09-22 15:07           ` Mathieu Desnoyers
2010-09-22 15:43             ` Jason Baron
2010-09-22 15:28           ` Jason Baron
2010-09-22 19:19             ` Mathieu Desnoyers
2010-09-22 13:46       ` Jason Baron
2010-09-22 18:14       ` Jason Baron
2010-09-22 11:57     ` Frederic Weisbecker
2010-09-22 16:12   ` H. Peter Anvin
2010-09-22 19:43     ` Mathieu Desnoyers
2010-09-22 20:06       ` H. Peter Anvin
2010-09-22 20:41         ` Mathieu Desnoyers
2010-09-22 20:54           ` H. Peter Anvin
2010-09-22 12:25 ` [PATCH 1/2] Add for_each_module iterator function Thomas Gleixner
2010-09-22 12:52   ` Andi Kleen
2010-09-22 14:03   ` Mathieu Desnoyers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox