Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Don't try to auto-unload modules unless they were auto-l...



details:   https://anonhg.NetBSD.org/src/rev/650fd4a3edf5
branches:  trunk
changeset: 770471:650fd4a3edf5
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Tue Oct 18 12:25:30 2011 +0000

description:
Don't try to auto-unload modules unless they were auto-loaded.

diffstat:

 sys/kern/kern_module.c |  12 ++++++++++--
 sys/sys/module.h       |   3 ++-
 2 files changed, 12 insertions(+), 3 deletions(-)

diffs (66 lines):

diff -r d84be036fe72 -r 650fd4a3edf5 sys/kern/kern_module.c
--- a/sys/kern/kern_module.c    Tue Oct 18 11:31:54 2011 +0000
+++ b/sys/kern/kern_module.c    Tue Oct 18 12:25:30 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_module.c,v 1.82 2011/09/19 00:40:22 pgoyette Exp $        */
+/*     $NetBSD: kern_module.c,v 1.83 2011/10/18 12:25:31 jmcneill Exp $        */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.82 2011/09/19 00:40:22 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.83 2011/10/18 12:25:31 jmcneill Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -1089,6 +1089,7 @@
                 * a short delay.
                 */
                mod->mod_autotime = time_second + module_autotime;
+               mod->mod_flags |= MODFLG_AUTO_LOADED;
                module_thread_kick();
        }
        depth--;
@@ -1273,8 +1274,14 @@
                kernconfig_lock();
                for (mod = TAILQ_FIRST(&module_list); mod != NULL; mod = next) {
                        next = TAILQ_NEXT(mod, mod_chain);
+
+                       /* skip built-in modules */
                        if (mod->mod_source == MODULE_SOURCE_KERNEL)
                                continue;
+                       /* skip modules that weren't auto-loaded */
+                       if ((mod->mod_flags & MODFLG_AUTO_LOADED) == 0)
+                               continue;
+
                        if (uvmexp.free < uvmexp.freemin) {
                                module_thread_ticks = hz;
                        } else if (mod->mod_autotime == 0) {
@@ -1285,6 +1292,7 @@
                        } else {
                                mod->mod_autotime = 0;
                        }
+
                        /*
                         * If this module wants to avoid autounload then
                         * skip it.  Some modules can ping-pong in and out
diff -r d84be036fe72 -r 650fd4a3edf5 sys/sys/module.h
--- a/sys/sys/module.h  Tue Oct 18 11:31:54 2011 +0000
+++ b/sys/sys/module.h  Tue Oct 18 12:25:30 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: module.h,v 1.27 2011/08/13 21:04:07 christos Exp $     */
+/*     $NetBSD: module.h,v 1.28 2011/10/18 12:25:30 jmcneill Exp $     */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -92,6 +92,7 @@
        u_int                   mod_fbtentries; /* DTrace FBT entrie count */
        int                     mod_flags;
 #define MODFLG_MUST_FORCE      0x01
+#define MODFLG_AUTO_LOADED     0x02
 
 } module_t;
 



Home | Main Index | Thread Index | Old Index