From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757925AbbBEOvj (ORCPT ); Thu, 5 Feb 2015 09:51:39 -0500 Received: from mail-lb0-f172.google.com ([209.85.217.172]:42665 "EHLO mail-lb0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757638AbbBEOvh (ORCPT ); Thu, 5 Feb 2015 09:51:37 -0500 From: Rasmus Villemoes To: Yury Cc: George Spelvin , akpm@linux-foundation.org, chris@chris-wilson.co.uk, davem@davemloft.net, dborkman@redhat.com, hannes@stressinduktion.org, klimov.linux@gmail.com, laijs@cn.fujitsu.com, linux-kernel@vger.kernel.org, msalter@redhat.com, takahiro.akashi@linaro.org, tgraf@suug.ch, valentinrothberg@gmail.com, Yury Norov Subject: Re: [PATCH v2 1/3] lib: find_*_bit reimplementation Organization: D03 References: <878uggr3tm.fsf@rasmusvillemoes.dk> <20150202114759.25525.qmail@ns.horizon.com> <87twz4pj44.fsf@rasmusvillemoes.dk> <54D2AF0E.30500@gmail.com> X-Hashcash: 1:20:150205:valentinrothberg@gmail.com::qPrhmhQsQ1iirxoV:000000000000000000000000000000000000F+H X-Hashcash: 1:20:150205:takahiro.akashi@linaro.org::uTSLDPnYkKGiyzRX:000000000000000000000000000000000000BOv X-Hashcash: 1:20:150205:chris@chris-wilson.co.uk::7MPzsfv1XKIZ1WH7:00000000000000000000000000000000000000lIa X-Hashcash: 1:20:150205:klimov.linux@gmail.com::6T4pttZw2bnkZAN1:0000000000000000000000000000000000000001BkB X-Hashcash: 1:20:150205:dborkman@redhat.com::v5In7l5lduK7t5Vs:0000000000000000000000000000000000000000001Ewp X-Hashcash: 1:20:150205:linux-kernel@vger.kernel.org::g7MjhKbOwL8v5icD:0000000000000000000000000000000001cGK X-Hashcash: 1:20:150205:yury.norov@gmail.com::QhyMZwh6rhT51bKn:00000000000000000000000000000000000000000495G X-Hashcash: 1:20:150205:laijs@cn.fujitsu.com::U4vS8yR+xquDw2c4:0000000000000000000000000000000000000000062Vq X-Hashcash: 1:20:150205:msalter@redhat.com::enIMDwebtPv7soho:00000000000000000000000000000000000000000006Kq5 X-Hashcash: 1:20:150205:hannes@stressinduktion.org::0kM/nr5YXeoe2y2B:000000000000000000000000000000000006aU+ X-Hashcash: 1:20:150205:y.norov@samsung.com::+4QMHVvqW5Jlcpvj:0000000000000000000000000000000000000000005j1g X-Hashcash: 1:20:150205:tgraf@suug.ch::6gLvXiu4NLIbAMXX:00008sd8 X-Hashcash: 1:20:150205:davem@davemloft.net::tGbbixjNkZXI400U:0000000000000000000000000000000000000000008heH X-Hashcash: 1:20:150205:linux@horizon.com::6Wr3XmoBar+aR9T3:000000000000000000000000000000000000000000009r1F X-Hashcash: 1:20:150205:akpm@linux-foundation.org::NW0QILcFk1UVkxtm:000000000000000000000000000000000000FPWB Date: Thu, 05 Feb 2015 15:51:32 +0100 In-Reply-To: <54D2AF0E.30500@gmail.com> (Yury's message of "Thu, 05 Feb 2015 02:45:18 +0300") Message-ID: <87wq3ws96z.fsf@rasmusvillemoes.dk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 05 2015, Yury wrote: > On 02.02.2015 15:56, Rasmus Villemoes wrote: >> On Mon, Feb 02 2015, "George Spelvin" wrote: >> >>> Rasmus Villemoes wrote: >>>> ... and this be part of _find_next_bit? Can find_next_bit not be simply >>>> 'return _find_next_bit(addr, size, offset, 1);', and similarly for >>>> find_next_zero_bit? Btw., passing true and false for the boolean >>>> parameter may be a little clearer. >>> Looking at the generated code, it would be better to replace the boolean >>> parameter with 0ul or ~0ul and XOR with it. The same number of registers, >>> and saves a conditional branch. >> Nice trick. When I compiled it, gcc inlined _find_next_bit into both its >> callers, making the conditional go away completely. That was with gcc >> 4.7. When I try with 5.0, I do see _find_next_bit being compiled >> separately. >> >> With the proposed change, 4.7 also makes find_next{,_zero}_bit wrappers >> for _find_next_bit, further reducing the total size, which is a good >> thing. And, if some other version decides to still inline it, it >> should then know how to optimize the xor with 0ul or ~0ul just as well >> as when the conditional was folded away. >> >> Yury, please also incorporate this in the next round. >> >> Rasmus >> > Ok. Good. > What are you thinking about joining _find_next_bit and > _find_next_bit_le? I don't think that should be done right now, if at all. The series is pretty close to getting my Reviewed-by; I'd prefer not to start over. Rasmus