Re: [PATCH] change pts allocation behaviour in

From: Steve Young
Date: Fri May 07 2004 - 06:56:18 EST


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. Using
the patch though, it will only take 257 iterations. As time goes on and
ptses get allocated and freed the situation becomes a bit murkier, but
the patch should still cut down the number of iterations required to find
a free pts.

Thanks,
Steve.
-
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/