Hannes Reinecke <hare@xxxxxxx> wrote:As Christian Borntraeger already said, it's not so much an explosion of module probes but rather the triggering of quite a lot of events. Imagine loading scsi_debug with 512 devices or more ...
the attached patch limits the number of concurrent hotplug processes.
Main idea behind it is that currently each call to call_usermodehelper will result in an execve() of "/sbin/hotplug", without any check whether enough resources are available for successful execution. This leads to hotplug being stuck and in worst cases to machines being unable to boot.
This check cannot be implemented in userspace as the resources are already taken by the time any resource check can be done; for the same reason any 'slim' programs as /sbin/hotplug will only delay the problem.
hm, it's a bit sad that this happens. Are you able to tell us more about
what is causing such an explosion of module probes?
Hmm; looks good, but: It's not possible to reliably change the maximum number of processes on the fly.
Any comments/suggestions welcome; otherwise please apply.
I suggest you just use a semaphore, initialised to a suitable value:
static struct semaphore foo = __SEMAPHORE_INITIALIZER(foo, 50);
{
...
down(&foo);
...
up(&foo);
...
}