[patch 1/8] Immediate Values - Global Modules List and Module Mutex

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <akpm@...>, <linux-kernel@...>
Cc: Mathieu Desnoyers <mathieu.desnoyers@...>
Date: Thursday, September 6, 2007 - 4:02 pm

Remove "static" from module_mutex and the modules list so it can be used by
other builtin objects in the kernel. Otherwise, every code depending on the
module list would have to be put in kernel/module.c. Since the immediate values
depends on the module list but can be considered as logically different, it
makes sense to implement them in their own file.

The alternative to this would be to disable preemption in code path that need
such synchronization, so they can be protected against module unload by
stop_machine(), but not being able to sleep within while needing such
synchronization is limiting.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
---
 include/linux/module.h |    4 ++++
 kernel/module.c        |    4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

Index: linux-2.6-lttng/kernel/module.c
===================================================================
--- linux-2.6-lttng.orig/kernel/module.c	2007-08-07 11:03:56.000000000 -0400
+++ linux-2.6-lttng/kernel/module.c	2007-08-07 11:40:22.000000000 -0400
@@ -64,8 +64,8 @@ extern int module_sysfs_initialized;
 
 /* List of modules, protected by module_mutex or preempt_disable
  * (add/delete uses stop_machine). */
-static DEFINE_MUTEX(module_mutex);
-static LIST_HEAD(modules);
+DEFINE_MUTEX(module_mutex);
+LIST_HEAD(modules);
 static DECLARE_MUTEX(notify_mutex);
 
 static BLOCKING_NOTIFIER_HEAD(module_notify_list);
Index: linux-2.6-lttng/include/linux/module.h
===================================================================
--- linux-2.6-lttng.orig/include/linux/module.h	2007-08-07 11:03:48.000000000 -0400
+++ linux-2.6-lttng/include/linux/module.h	2007-08-07 11:39:55.000000000 -0400
@@ -60,6 +60,10 @@ struct module_kobject
 	struct kobject *drivers_dir;
 };
 
+/* Protects the list of modules. */
+extern struct mutex module_mutex;
+extern struct list_head modules;
+
 /* These are either module local, or the kernel's dummy ones. */
 extern int init_module(void);
 extern void cleanup_module(void);

-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 1/8] Immediate Values - Global Modules List and Modul..., Mathieu Desnoyers, (Thu Sep 6, 4:02 pm)
Re: [patch 1/8] Immediate Values - Global Modules List and M..., Mathieu Desnoyers, (Mon Sep 10, 8:45 pm)
Re: [patch 1/8] Immediate Values - Global Modules List and M..., Mathieu Desnoyers, (Tue Sep 11, 10:27 am)
Re: [patch 1/8] Immediate Values - Global Modules List and M..., Mathieu Desnoyers, (Thu Sep 13, 5:21 pm)
Re: [patch 1/8] Immediate Values - Global Modules List and M..., Mathieu Desnoyers, (Fri Sep 14, 11:32 am)
Re: [patch 1/8] Immediate Values - Global Modules List and M..., Mathieu Desnoyers, (Tue Sep 18, 9:41 am)
Re: [patch 1/8] Immediate Values - Global Modules List and M..., Mathieu Desnoyers, (Fri Sep 21, 9:37 am)