Messages in this thread | | | Date | Thu, 26 Feb 2004 17:19:28 -0800 | From | Andrew Morton <> | Subject | Re: [BK PATCH] SCSI host num allocation improvement |
| |
Ben Collins <bcollins@debian.org> wrote: > > +next_host_num_try: > + list_for_each_entry(cdev, &class->children, node) { > + shost = class_to_shost(cdev); > + if (shost->host_no == host_num) { > + host_num++; > + goto next_host_num_try;
yitch. I realise this is called rarely, for realtively small numbers of N (which gets squared), but.
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.
The lib/idr.c code is a bit clumsy but it does do the job relatively efficiently. If it needs some helper wrappers or API simplification then let's add those. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |