|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] x86/bitops: Introduce variable/constant pairs for __{set, clear, change}_bit()
>>> On 11.01.18 at 17:34, <andrew.cooper3@xxxxxxxxxx> wrote:
> Just as with test_bit, the non-atomic set/clear/change helpers can be better
> optimised by the compiler in the case that the nr parameter is constant, and
> it often is.
>
> This results in a general replacement of `mov $imm, %reg; bt* %reg, mem` with
> the more simple `op $imm, mem`, reducing register pressure.
>
> The net diffstat is:
> add/remove: 0/1 grow/shrink: 5/17 up/down: 90/-301 (-211)
>
> As a piece of minor cleanup, drop unnecessary brackets in the test_bit()
> macro, and fix the indentation.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
> @@ -291,9 +309,9 @@ static inline int variable_test_bit(int nr, const
> volatile void *addr)
>
> #define test_bit(nr, addr) ({ \
> if ( bitop_bad_size(addr) ) __bitop_bad_size(); \
> - (__builtin_constant_p(nr) ? \
> - constant_test_bit((nr),(addr)) : \
> - variable_test_bit((nr),(addr))); \
> + __builtin_constant_p(nr) ? \
> + constant_test_bit(nr, addr) : \
> + variable_test_bit(nr, addr); \
> })
I appreciate you also doing the cleanup here, yielding a consistent
overall result.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |