lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 15 May 2017 23:04:13 +0200
From:   Arnd Bergmann <arnd@...db.de>
To:     Yury Norov <ynorov@...iumnetworks.com>
Cc:     Ingo Molnar <mingo@...nel.org>,
        linux-arch <linux-arch@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Richard Henderson <rth@...ddle.net>,
        Ivan Kokshaysky <ink@...assic.park.msu.ru>,
        Matt Turner <mattst88@...il.com>,
        Akinobu Mita <mita@...aclelinux.com>,
        Mike Galbraith <efault@....de>
Subject: Re: [PATCH] sched: remove sched_find_first_bit()

On Mon, May 15, 2017 at 10:58 PM, Yury Norov <ynorov@...iumnetworks.com> wrote:
> On Mon, May 15, 2017 at 10:31:17PM +0200, Arnd Bergmann wrote:
>> On Mon, May 15, 2017 at 6:17 PM, Yury Norov <ynorov@...iumnetworks.com> wrote:
>>
> Yes, something like this. But size is not the multiple of BITS_PER_LONG in
> general. This should work better:
>
>        switch (round_up(size), BITS_PER_LONG) {
>        case BITS_PER_LONG * 4:
>                if (addr[0])
>                        goto ret;
>                addr++;
>                idx += BITS_PER_LONG;
>        case BITS_PER_LONG * 3:
>                if (addr[0])
>                        goto ret;
>                addr++;
>                idx += BITS_PER_LONG;
>        case BITS_PER_LONG * 2:
>                if (addr[0])
>                        goto ret;
>                addr++;
>                idx += BITS_PER_LONG;
>        case BITS_PER_LONG * 1:
>                if (addr[0])
>                        goto ret;
>                addr++;
>                idx += BITS_PER_LONG;
>                return idx;
>        }
>
>        return __find_first_bit(addr, size);
>
> ret:
>        return idx + min(__ffs(addr[0]), size % BITS_PER_LONG;
>        }
>
> (I didn't test it yet though)
>
>> However, on architectures that rely on
>> include/asm-generic/bitops/__ffs.h or something
>> similarly verbose, this would just add needless bloat
>> to the size rather than actually making a difference
>> in performance.

I tried something along these lines earlier and couldn't
get it to produce the comparable object code in the
common case.

For sched_find_first_bit() I was able to cheat and
pass 128 as the length (along with a comment), and
most others are either multiples of BITS_PER_LONG,
or they are not constant.

       Arnd

Powered by blists - more mailing lists