Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1632038 > unrolled thread
| Started by | Geert Uytterhoeven <geert@linux-m68k.org> |
|---|---|
| First post | 2017-04-27 13:30 +0200 |
| Last post | 2017-04-27 13:30 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH 4/8] random: remove unused branch in hot code path Geert Uytterhoeven <geert@linux-m68k.org> - 2017-04-27 13:30 +0200
| From | Geert Uytterhoeven <geert@linux-m68k.org> |
|---|---|
| Date | 2017-04-27 13:30 +0200 |
| Subject | Re: [PATCH 4/8] random: remove unused branch in hot code path |
| Message-ID | <tAPMt-8fr-3@gated-at.bofh.it> |
Hi Ted,
(replying to an old thread)
On Wed, Jan 18, 2017 at 5:35 AM, Theodore Ts'o <tytso@mit.edu> wrote:
> On Tue, Dec 27, 2016 at 11:40:23PM +0100, Stephan Müller wrote:
>> The variable ip is defined to be a __u64 which is always 8 bytes on any
>> architecture. Thus, the check for sizeof(ip) > 4 will always be true.
>>
>> As the check happens in a hot code path, remove the branch.
>
> The fact that it's a hot code path means the compiler will optimize it
> out, so the fact that it's on the hot code path is irrelevant. The
> main issue is that on platforms with a 32-bit IP's, ip >> 32 will
> always be zero. It might be that we can just do this via
>
> #if BITS_PER_LONG == 32
> ...
> #else
> ...
> #endif
>
> I'm not sure that works for all platforms, though. More research is
> needed...
Is the intention for the test "sizeof(ip) > 4" to distinguish between
32-bit and 64-bit platforms?
As ip is __u64, while regs is a pointer, shouldn't the test be
"sizeof(regs) > 4"?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Back to top | Article view | linux.kernel
csiph-web