lkml.org 
[lkml]   [2004]   [Feb]   [11]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateFri, 13 Feb 2004 23:14:07 +0100
FromAndi Kleen <>
SubjectRe: [PATCH] [2.6] [1/2] hlist: replace explicit checks of hlist fields w/ func calls
On Tue, 10 Feb 2004 22:28:11 -0800
Alex Pankratov <ap@swapped.cc> wrote:

> 
> Second patch removes if's from hlist_xxx() functions. The idea
> is to terminate the list not with 0, but with a pointer at a
> special 'null' item. Luckily a single 'null' can be shared
> between all hlists _without_ any synchronization, because its
> 'next' and 'pprev' fields are never read. In fact, 'next' is
> not accessed at all, and 'pprev' is used only for writing.

I disagree with this change. The problem is that in a loop
you need a register now to store the terminating element
and compare to it instead of just testing for zero. This can generate 
much worse code  on register starved i386 than having the conditional.

If you really want to avoid the conditional you could restructure
it so that i386 gcc can use a CMOV* (by using a pointer that either
points to a dummy or the target). But that would make the code
somewhat uglier and may not be worth it.

-Andi
-
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/

\
 
 \ /
  Last update: 2005-03-22 14:00    [from the cache]
©2003-2008