Re: [BK PATCH] SCSI host num allocation improvement

From: H. Peter Anvin
Date: Fri Feb 27 2004 - 13:56:08 EST


Followup to: <20040226171928.750f5f6f.akpm@xxxxxxxx>
By author: Andrew Morton <akpm@xxxxxxxx>
In newsgroup: linux.dev.kernel
>
> This allocate-me-the-lowest-available-number is a common idiom in the
> kernel and we really should do it better. Seems we need to convert the
> dynamic pty allocation to do it as well - it has yet another open-coded
> ad-hoc allocator.
>

Well, I actually *didn't* want it to be allocate-the-lowest-available
number. I deliberately went with the same allocation scheme used for
PIDs (continual advance with wraparound and duplication avoidance);
this is a cheap approximation of NRU.

Immediate re-use is *BAD* (in the pty example, it means you're liable
to have "write" write to an unrelated session by mistake, for example)
at least if there is no penalty for expanding into the full allocated
number space. Lowest available number is architecturally mandated for
file descriptors, but it doesn't mean it's a preferred allocation
scheme by any means.

-hpa

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