From: Andrew Morton <akpm@osdl.org>
To: Ben Collins <bcollins@debian.org>
Cc: James.Bottomley@steeleye.com, linux-kernel@vger.kernel.org
Subject: Re: [BK PATCH] SCSI host num allocation improvement
Date: Thu, 26 Feb 2004 17:19:28 -0800 [thread overview]
Message-ID: <20040226171928.750f5f6f.akpm@osdl.org> (raw)
In-Reply-To: <20040226235412.GA819@phunnypharm.org>
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.
next prev parent reply other threads:[~2004-02-27 1:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-26 23:54 Ben Collins
2004-02-27 1:19 ` Andrew Morton [this message]
2004-02-27 1:37 ` Andrew Morton
2004-02-27 2:09 ` Ben Collins
2004-02-27 2:32 ` Ben Collins
2004-02-27 2:51 ` Andrew Morton
2004-02-27 2:50 ` Ben Collins
2004-02-27 3:04 ` Ben Collins
2004-02-27 16:33 ` Mike Anderson
2004-02-27 22:30 ` Andrew Morton
2004-02-27 18:51 ` H. Peter Anvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040226171928.750f5f6f.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=James.Bottomley@steeleye.com \
--cc=bcollins@debian.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®