Re: [PATCH] change pts allocation behaviour in

From: Andrew Morton
Date: Fri May 07 2004 - 15:00:48 EST


Steve Young <sdyoung@xxxxxxxxx> wrote:
>
> On Fri, May 07, 2004 at 04:14:42AM -0700, Andrew Morton wrote:
> > > in the range of 0-255 first. However, if that fails, then it will search the
> > > higher ranges.
> >
> > Wouldn't we be better off with plain old first-fit-from-zero?
>
> In the typical case where <256 pts devices are allocated, you're right that
> there will be no benefit over the first-fit-from-zero implementation. However
> when there are a lot of pts devices in use, the algorithm used for searching
> the high ranges ought to generally find a new pts in fewer iterations than
> just linearly searching from 0 to the maximum pts number. For example, if a
> system allocates 5000 ptses in a row, when it goes to look for a new one with
> first-fit-from-zero, that's 5001 iterations to find an available pts.

first-fit-from-zero does not imply linear search! The idr.c code provides
a logarithmic-time search.
-
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/