Re: [PATCH] Limit number of concurrent hotplug processes

From: Andrew Morton
Date: Sun Jul 25 2004 - 20:23:02 EST


Hannes Reinecke <hare@xxxxxxx> wrote:
>
> 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?

> 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);
...
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/