27 May, 2011

1 commit

  • The style that we normally use in asm-generic is to test the macro itself
    for existence, so in asm-generic, do:

    #ifndef find_next_zero_bit_le
    extern unsigned long find_next_zero_bit_le(const void *addr,
    unsigned long size, unsigned long offset);
    #endif

    and in the architectures, write

    static inline unsigned long find_next_zero_bit_le(const void *addr,
    unsigned long size, unsigned long offset)
    #define find_next_zero_bit_le find_next_zero_bit_le

    This adds the #ifndef for each of the find bitops in the generic header
    and source files.

    Suggested-by: Arnd Bergmann
    Signed-off-by: Akinobu Mita
    Acked-by: Russell King
    Cc: Martin Schwidefsky
    Cc: Heiko Carstens
    Cc: Greg Ungerer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Akinobu Mita
     

10 Oct, 2010

2 commits

  • If CONFIG_GENERIC_FIND_NEXT_BIT is enabled, find_next_bit() and
    find_next_zero_bit() are doubly declared in asm-generic/bitops/find.h
    and linux/bitops.h.

    asm/bitops.h includes asm-generic/bitops/find.h if and only if the
    architecture enables CONFIG_GENERIC_FIND_NEXT_BIT. And asm/bitops.h
    is included by linux/bitops.h

    So we can just remove the extern declarations of find_next_bit() and
    find_next_zero_bit() in linux/bitops.h.

    Also we can remove unneeded #ifndef CONFIG_GENERIC_FIND_NEXT_BIT in
    asm-generic/bitops/find.h.

    Signed-off-by: Akinobu Mita
    Signed-off-by: Arnd Bergmann

    Akinobu Mita
     
  • asm-generic/bitops/find.h has the extern declarations of find_next_bit()
    and find_next_zero_bit() and the macro definitions of find_first_bit()
    and find_first_zero_bit(). It is only usable by the architectures which
    enables CONFIG_GENERIC_FIND_NEXT_BIT and disables
    CONFIG_GENERIC_FIND_FIRST_BIT.

    x86 and tile enable both CONFIG_GENERIC_FIND_NEXT_BIT and
    CONFIG_GENERIC_FIND_FIRST_BIT. These architectures cannot include
    asm-generic/bitops/find.h in their asm/bitops.h. So ifdefed extern
    declarations of find_first_bit and find_first_zero_bit() are put in
    linux/bitops.h.

    This makes asm-generic/bitops/find.h usable by these architectures
    and use it. Also this change is needed for the forthcoming duplicated
    extern declarations cleanup.

    Signed-off-by: Akinobu Mita
    Signed-off-by: Arnd Bergmann
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: "H. Peter Anvin"
    Cc: x86@kernel.org
    Cc: Chris Metcalf

    Akinobu Mita
     

27 Apr, 2008

1 commit

  • This moves an optimization for searching constant-sized small
    bitmaps form x86_64-specific to generic code.

    On an i386 defconfig (the x86#testing one), the size of vmlinux hardly
    changes with this applied. I have observed only four places where this
    optimization avoids a call into find_next_bit:

    In the functions return_unused_surplus_pages, alloc_fresh_huge_page,
    and adjust_pool_surplus, this patch avoids a call for a 1-bit bitmap.
    In __next_cpu a call is avoided for a 32-bit bitmap. That's it.

    On x86_64, 52 locations are optimized with a minimal increase in
    code size:

    Current #testing defconfig:
    146 x bsf, 27 x find_next_*bit
    text data bss dec hex filename
    5392637 846592 724424 6963653 6a41c5 vmlinux

    After removing the x86_64 specific optimization for find_next_*bit:
    94 x bsf, 79 x find_next_*bit
    text data bss dec hex filename
    5392358 846592 724424 6963374 6a40ae vmlinux

    After this patch (making the optimization generic):
    146 x bsf, 27 x find_next_*bit
    text data bss dec hex filename
    5392396 846592 724424 6963412 6a40d4 vmlinux

    [ tglx@linutronix.de: build fixes ]

    Signed-off-by: Ingo Molnar

    Alexander van Heukelum
     

27 Mar, 2006

1 commit

  • This patch introduces the C-language equivalents of the functions below:

    unsigned logn find_next_bit(const unsigned long *addr, unsigned long size,
    unsigned long offset);
    unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
    unsigned long offset);
    unsigned long find_first_zero_bit(const unsigned long *addr,
    unsigned long size);
    unsigned long find_first_bit(const unsigned long *addr, unsigned long size);

    In include/asm-generic/bitops/find.h

    This code largely copied from: arch/powerpc/lib/bitops.c

    Signed-off-by: Akinobu Mita
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Akinobu Mita