From: hpa@zytor.com (H. Peter Anvin)
To: linux-kernel@vger.kernel.org
Subject: Re: [BK PATCH] SCSI host num allocation improvement
Date: Fri, 27 Feb 2004 18:51:12 +0000 (UTC) [thread overview]
Message-ID: <c1o3j0$ir3$1@terminus.zytor.com> (raw)
In-Reply-To: 20040226171928.750f5f6f.akpm@osdl.org
Followup to: <20040226171928.750f5f6f.akpm@osdl.org>
By author: Andrew Morton <akpm@osdl.org>
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
prev parent reply other threads:[~2004-02-27 18:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-26 23:54 [BK PATCH] SCSI host num allocation improvement Ben Collins
2004-02-27 1:19 ` Andrew Morton
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 [this message]
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='c1o3j0$ir3$1@terminus.zytor.com' \
--to=hpa@zytor.com \
--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