Re: [PATCH] Limit number of concurrent hotplug processes

From: Andrew Morton
Date: Tue Jul 27 2004 - 02:27:21 EST


Hannes Reinecke <hare@xxxxxxx> wrote:
>
> The problem (from my point of view) with semaphores is that we don't
> have an direct counter of the number of processes waiting on that
> semaphore to become free. We do have a counter for the number of
> processes which are allowed to use the semaphore concurrently (namely
> ->count), but the number of waiting processes must be gathered
> indirectly by the number of entries in the waitqueue.

Well one could add the number of sleepers to the semaphore, or write some
function which counts the number of entries on the waitqueue or something.
But the result of this query would be out-of-date as soon as the caller
obtained it and massaging all architectures would be needed.

I don't see why the "number of waiters" needs to be known for this problem.

> Given enough processes in the waitqueue, the number of currently running
> processes effectively determines the number of processes to be started.
> And as those processes are already running, I don't see an effective
> procedure how we could _reduce_ the number of processes to be started.

By reducing the number of processes which can concurrently take the
semaphore? Confused.

-
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/