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, 16 Jan 2017 19:59:50 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Jaewon Kim <jaewon31.kim@...sung.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Andrew Morton <akpm@...ux-foundation.org>, labbott@...hat.com,
        Michal Nazarewicz <mina86@...a86.com>,
        m.szyprowski@...sung.com, gregory.0xf0@...il.com,
        Laurent Pinchart <laurent.pinchart@...asonboard.com>,
        akinobu.mita@...il.com, linux-mm@...ck.org,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        jaewon31.kim@...il.com
Subject: Re: [PATCH] lib: bitmap: introduce bitmap_find_next_zero_area_and_size

On Mon, Dec 26, 2016 at 6:18 AM, Jaewon Kim <jaewon31.kim@...sung.com> wrote:
> There was no bitmap API which returns both next zero index and size of zeros
> from that index.
>
> This is helpful to look fragmentation. This is an test code to look size of zeros.
> Test result is '10+9+994=>1013 found of total: 1024'
>
> unsigned long search_idx, found_idx, nr_found_tot;
> unsigned long bitmap_max;
> unsigned int nr_found;
> unsigned long *bitmap;
>
> search_idx = nr_found_tot = 0;
> bitmap_max = 1024;
> bitmap = kzalloc(BITS_TO_LONGS(bitmap_max) * sizeof(long),
>                  GFP_KERNEL);
>
> /* test bitmap_set offset, count */
> bitmap_set(bitmap, 10, 1);
> bitmap_set(bitmap, 20, 10);
>
> for (;;) {
>         found_idx = bitmap_find_next_zero_area_and_size(bitmap,
>                                 bitmap_max, search_idx, &nr_found);
>         if (found_idx >= bitmap_max)
>                 break;
>         if (nr_found_tot == 0)
>                 printk("%u", nr_found);
>         else
>                 printk("+%u", nr_found);
>         nr_found_tot += nr_found;
>         search_idx = found_idx + nr_found;
> }
> printk("=>%lu found of total: %lu\n", nr_found_tot, bitmap_max);

Tests should be added to corresponding test module. See lib/*test*
files for details.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ