Re: [tip:core/locking] locking, x86: Slightly shorten __ticket_spin_trylock()

From: Jan Beulich
Date: Wed Dec 02 2009 - 09:07:12 EST


>>> Ingo Molnar <mingo@xxxxxxx> 02.12.09 14:29 >>>
>at first quick sight, this bit looks odd:
>
>+ union { int i; bool b; } new;
>
>+ return new.b;
>
>shouldnt that be short based, to work correctly in the 0-255 CPUs case?

No, I can't see why. In both instances, we're using (and had been
using previously, just with the added movzbl) the outcome of a
setCC instruction, which produces valid bool (single byte) values.
It is precisely that reason why I needed to introduce these unions,
since the upper bytes of the register aren't valid (and shouldn't be
looked at by the caller).

Do you happen to have the vmlinux binary still around, to look at
the code your compiler generated (I went through the code I got
in quite a bit of detail to make sure it got translated correctly)?

Jan

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/