Current-Users archive

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

Re: module auto-unload



In article <Pine.NEB.4.64.1312151007210.21023%screamer.whooppee.com@localhost>,
Paul Goyette  <paul%whooppee.com@localhost> wrote:
>-=-=-=-=-=-
>
>On Sun, 15 Dec 2013, Paul Goyette wrote:
>
>> Given the recent discussion on the usefulness of auto-unload, would it 
>> possibly make sense to enable/disable this via a new sysctl variable?
>>
>> We could make kern.module.unload_delay default to 10 seconds (the current 
>> default);  if the delay is ever set to a non-positive value, it would 
>> disable 
>> the auto-unload feature completely.
>>
>> Comments?
>
>The attached patch has been compile-tested, but not actually booted.  If 
>anyone wants to give it a try, please let me know if it works.
>
>
>
>+      if (t < 0)
>+              return (EINVAL);

You are not allowing it to become negative.

>  *    Automatically unload modules.  We try once to unload autoloaded
>  *    modules after module_autotime seconds.  If the system is under
>- *    severe memory pressure, we'll try unloading all modules.
>+ *    severe memory pressure, we'll try unloading all modules, else if
>+ *    module_autotime is non-positive, we don't try to unload.
>  */
> static void
> module_thread(void *cookie)
>@@ -1311,6 +1341,8 @@ module_thread(void *cookie)
> 
>                       if (uvmexp.free < uvmexp.freemin) {
>                               module_thread_ticks = hz;
>+                      } else if (module_autotime <= 0) {
>+                              continue;

Yet, you add a check for it. I would just not add the two lines above,
and have only 0 mean "never unload"

>                       } else if (mod->mod_autotime == 0) {
>                               continue;
>                       } else if (time_second < mod->mod_autotime) {
>-=-=-=-=-=-

christos



Home | Main Index | Thread Index | Old Index