Module Name: src Committed By: jmcneill Date: Tue Oct 18 12:25:31 UTC 2011
Modified Files: src/sys/kern: kern_module.c src/sys/sys: module.h Log Message: Don't try to auto-unload modules unless they were auto-loaded. To generate a diff of this commit: cvs rdiff -u -r1.82 -r1.83 src/sys/kern/kern_module.c cvs rdiff -u -r1.27 -r1.28 src/sys/sys/module.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/kern_module.c diff -u src/sys/kern/kern_module.c:1.82 src/sys/kern/kern_module.c:1.83 --- src/sys/kern/kern_module.c:1.82 Mon Sep 19 00:40:22 2011 +++ src/sys/kern/kern_module.c Tue Oct 18 12:25:31 2011 @@ -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 @@ module_do_load(const char *name, bool is * a short delay. */ mod->mod_autotime = time_second + module_autotime; + mod->mod_flags |= MODFLG_AUTO_LOADED; module_thread_kick(); } depth--; @@ -1273,8 +1274,14 @@ module_thread(void *cookie) 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 @@ module_thread(void *cookie) } else { mod->mod_autotime = 0; } + /* * If this module wants to avoid autounload then * skip it. Some modules can ping-pong in and out Index: src/sys/sys/module.h diff -u src/sys/sys/module.h:1.27 src/sys/sys/module.h:1.28 --- src/sys/sys/module.h:1.27 Sat Aug 13 21:04:07 2011 +++ src/sys/sys/module.h Tue Oct 18 12:25:30 2011 @@ -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 @@ typedef struct module { u_int mod_fbtentries; /* DTrace FBT entrie count */ int mod_flags; #define MODFLG_MUST_FORCE 0x01 +#define MODFLG_AUTO_LOADED 0x02 } module_t;