From: Andi Kleen <ak@suse.de>
To: "David S. Miller" <davem@redhat.com>
Cc: Andrew Morton <akpm@osdl.org>, linux-arch@vger.kernel.org
Subject: Re: find_next_bit return type
Date: Mon, 2 Aug 2004 12:40:22 +0200 [thread overview]
Message-ID: <20040802104022.GA25951@wotan.suse.de> (raw)
In-Reply-To: <20040801001026.68ed7363.davem@redhat.com>
On Sun, Aug 01, 2004 at 12:10:26AM -0700, David S. Miller wrote:
> On Sun, 1 Aug 2004 00:02:13 -0700
> Andrew Morton <akpm@osdl.org> wrote:
>
> > Kind-of. But it's also cringeworthy to go slinging 8-byte values around
> > when 4-byte values would suffice. Is it not more efficient to use
> > integers?
>
> They all go in registers, the same register that could hold the 4-byte
> values too. There is also no computational cost to doing 64-bit add
> subtract and shift (ie. simple ALU's) compared to 32-bit ones.
Actually at least on Intel EM64T an 64bit sub/add is slower, so it's not
generally true. And 64bit ops generate bigger code on x86-64.
But I still agree with you David that returning long here is better.
Even though I consider it unlikely that anybody will search >4GB
bitmaps in kernel any time soon (it would be a latency disaster).
But for the usual implementation (find_* subtracting two pointers)
the function has to do a 64bit subtraction anyways, otherwise
you get a subtle "broken when crossing 4GB boundaries" bug.
For consistency it is better to have long here.
-Andi
next prev parent reply other threads:[~2004-08-02 10:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-01 6:24 find_next_bit return type Andrew Morton
2004-08-01 6:25 ` Andrew Morton
2004-08-01 6:58 ` David S. Miller
2004-08-01 7:02 ` Andrew Morton
2004-08-01 7:10 ` David S. Miller
2004-08-02 10:40 ` Andi Kleen [this message]
2004-08-01 6:25 ` Andrew Morton
2004-08-01 6:26 ` Andrew Morton
2004-08-01 11:53 ` William Lee Irwin III
2004-08-01 13:51 ` William Lee Irwin III
2004-08-01 15:05 ` James Bottomley
2004-08-01 15:07 ` William Lee Irwin III
2004-08-01 22:09 ` Paul Mackerras
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=20040802104022.GA25951@wotan.suse.de \
--to=ak@suse.de \
--cc=akpm@osdl.org \
--cc=davem@redhat.com \
--cc=linux-arch@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