31 Mar, 2006

1 commit


27 Mar, 2006

6 commits

  • We use it generally now, at least blktrace isn't a specific debug
    kernel feature.

    Signed-off-by: Jens Axboe

    Jens Axboe
     
  • wrote:

    This is an extremely well-known technique. You can see a similar version that
    uses a multiply for the last few steps at
    http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel whch
    refers to "Software Optimization Guide for AMD Athlon 64 and Opteron
    Processors"
    http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/25112.PDF

    It's section 8.6, "Efficient Implementation of Population-Count Function in
    32-bit Mode", pages 179-180.

    It uses the name that I am more familiar with, "popcount" (population count),
    although "Hamming weight" also makes sense.

    Anyway, the proof of correctness proceeds as follows:

    b = a - ((a >> 1) & 0x55555555);
    c = (b & 0x33333333) + ((b >> 2) & 0x33333333);
    d = (c + (c >> 4)) & 0x0f0f0f0f;
    #if SLOW_MULTIPLY
    e = d + (d >> 8)
    f = e + (e >> 16);
    return f & 63;
    #else
    /* Useful if multiply takes at most 4 cycles */
    return (d * 0x01010101) >> 24;
    #endif

    The input value a can be thought of as 32 1-bit fields each holding their own
    hamming weight. Now look at it as 16 2-bit fields. Each 2-bit field a1..a0
    has the value 2*a1 + a0. This can be converted into the hamming weight of the
    2-bit field a1+a0 by subtracting a1.

    That's what the (a >> 1) & mask subtraction does. Since there can be no
    borrows, you can just do it all at once.

    Enumerating the 4 possible cases:

    0b00 = 0 -> 0 - 0 = 0
    0b01 = 1 -> 1 - 0 = 1
    0b10 = 2 -> 2 - 1 = 1
    0b11 = 3 -> 3 - 1 = 2

    The next step consists of breaking up b (made of 16 2-bir fields) into
    even and odd halves and adding them into 4-bit fields. Since the largest
    possible sum is 2+2 = 4, which will not fit into a 4-bit field, the 2-bit
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    "which will not fit into a 2-bit field"

    fields have to be masked before they are added.

    After this point, the masking can be delayed. Each 4-bit field holds a
    population count from 0..4, taking at most 3 bits. These numbers can be added
    without overflowing a 4-bit field, so we can compute c + (c >> 4), and only
    then mask off the unwanted bits.

    This produces d, a number of 4 8-bit fields, each in the range 0..8. From
    this point, we can shift and add d multiple times without overflowing an 8-bit
    field, and only do a final mask at the end.

    The number to mask with has to be at least 63 (so that 32 on't be truncated),
    but can also be 128 or 255. The x86 has a special encoding for signed
    immediate byte values -128..127, so the value of 255 is slower. On other
    processors, a special "sign extend byte" instruction might be faster.

    On a processor with fast integer multiplies (Athlon but not P4), you can
    reduce the final few serially dependent instructions to a single integer
    multiply. Consider d to be 3 8-bit values d3, d2, d1 and d0, each in the
    range 0..8. The multiply forms the partial products:

    d3 d2 d1 d0
    d3 d2 d1 d0
    d3 d2 d1 d0
    + d3 d2 d1 d0
    ----------------------
    e3 e2 e1 e0

    Where e3 = d3 + d2 + d1 + d0. e2, e1 and e0 obviously cannot generate
    any carries.

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

    Akinobu Mita
     
  • By defining generic hweight*() routines

    - hweight64() will be defined on all architectures
    - hweight_long() will use architecture optimized hweight32() or hweight64()

    I found two possible cleanups by these reasons.

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

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

    int ext2_set_bit(int nr, volatile unsigned long *addr);
    int ext2_clear_bit(int nr, volatile unsigned long *addr);
    int ext2_test_bit(int nr, const volatile unsigned long *addr);
    unsigned long ext2_find_first_zero_bit(const unsigned long *addr,
    unsigned long size);
    unsinged long ext2_find_next_zero_bit(const unsigned long *addr,
    unsigned long size);

    In include/asm-generic/bitops/ext2-non-atomic.h

    This code largely copied from:

    include/asm-powerpc/bitops.h
    include/asm-parisc/bitops.h

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

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

    unsigned int hweight32(unsigned int w);
    unsigned int hweight16(unsigned int w);
    unsigned int hweight8(unsigned int w);
    unsigned long hweight64(__u64 w);

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

    This code largely copied from: include/linux/bitops.h

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

    Akinobu Mita
     
  • 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
     

26 Mar, 2006

9 commits

  • DEBUG_KERNEL is often enabled just for sysrq, but this doesn't
    mean the user wants more heavyweight debugging information.

    Cc: jbeulich@novell.com

    Signed-off-by: Andi Kleen
    Signed-off-by: Linus Torvalds

    Andi Kleen
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivial: (21 commits)
    BUG_ON() Conversion in drivers/video/
    BUG_ON() Conversion in drivers/parisc/
    BUG_ON() Conversion in drivers/block/
    BUG_ON() Conversion in sound/sparc/cs4231.c
    BUG_ON() Conversion in drivers/s390/block/dasd.c
    BUG_ON() Conversion in lib/swiotlb.c
    BUG_ON() Conversion in kernel/cpu.c
    BUG_ON() Conversion in ipc/msg.c
    BUG_ON() Conversion in block/elevator.c
    BUG_ON() Conversion in fs/coda/
    BUG_ON() Conversion in fs/binfmt_elf_fdpic.c
    BUG_ON() Conversion in input/serio/hil_mlc.c
    BUG_ON() Conversion in md/dm-hw-handler.c
    BUG_ON() Conversion in md/bitmap.c
    The comment describing how MS_ASYNC works in msync.c is confusing
    rcu: undeclared variable used in documentation
    fix typos "wich" -> "which"
    typo patch for fs/ufs/super.c
    Fix simple typos
    tabify drivers/char/Makefile
    ...

    Linus Torvalds
     
  • text data bss dec hex filename
    before: 3605597 1363528 363328 5332453 515de5 vmlinux
    after: 3605295 1363612 363200 5332107 515c8b vmlinux

    218 bytes saved.

    Also, optimise any_online_cpu() out of existence on CONFIG_SMP=n.

    This function seems inefficient. Can't we simply AND the two masks, then use
    find_first_bit()?

    Cc: Paul Jackson
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • Shrinks the only caller (net/bridge/netfilter/ebtables.c) by 174 bytes.

    Also, optimise highest_possible_processor_id() out of existence on
    CONFIG_SMP=n.

    Cc: Paul Jackson
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • text data bss dec hex filename
    before: 3488027 1322496 360128 5170651 4ee5db vmlinux
    after: 3485112 1322480 359968 5167560 4ed9c8 vmlinux

    2931 bytes saved

    Cc: Paul Jackson
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • text data bss dec hex filename
    before: 3490577 1322408 360000 5172985 4eeef9 vmlinux
    after: 3488027 1322496 360128 5170651 4ee5db vmlinux

    Cc: Paul Jackson
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • Documentation changes to help radix tree users avoid overrunning the tags
    array. RADIX_TREE_TAGS moves to linux/radix-tree.h and is now known as
    RADIX_TREE_MAX_TAGS (Nick Piggin's idea). Tag parameters are changed to
    unsigned, and some comments are updated.

    Signed-off-by: Jonathan Corbet
    Cc: Nick Piggin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jonathan Corbet
     
  • The Kconfig text for CONFIG_DEBUG_SLAB and CONFIG_DEBUG_PAGEALLOC have always
    seemed a bit confusing. Change them to:

    CONFIG_DEBUG_SLAB: "Debug slab memory allocations"
    CONFIG_DEBUG_PAGEALLOC: "Debug page memory allocations"

    Cc: "David S. Miller"
    Cc: Hirokazu Takata
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • Implement /proc/slab_allocators. It produces output like:

    idr_layer_cache: 80 idr_pre_get+0x33/0x4e
    buffer_head: 2555 alloc_buffer_head+0x20/0x75
    mm_struct: 9 mm_alloc+0x1e/0x42
    mm_struct: 20 dup_mm+0x36/0x370
    vm_area_struct: 384 dup_mm+0x18f/0x370
    vm_area_struct: 151 do_mmap_pgoff+0x2e0/0x7c3
    vm_area_struct: 1 split_vma+0x5a/0x10e
    vm_area_struct: 11 do_brk+0x206/0x2e2
    vm_area_struct: 2 copy_vma+0xda/0x142
    vm_area_struct: 9 setup_arg_pages+0x99/0x214
    fs_cache: 8 copy_fs_struct+0x21/0x133
    fs_cache: 29 copy_process+0xf38/0x10e3
    files_cache: 30 alloc_files+0x1b/0xcf
    signal_cache: 81 copy_process+0xbaa/0x10e3
    sighand_cache: 77 copy_process+0xe65/0x10e3
    sighand_cache: 1 de_thread+0x4d/0x5f8
    anon_vma: 241 anon_vma_prepare+0xd9/0xf3
    size-2048: 1 add_sect_attrs+0x5f/0x145
    size-2048: 2 journal_init_revoke+0x99/0x302
    size-2048: 2 journal_init_revoke+0x137/0x302
    size-2048: 2 journal_init_inode+0xf9/0x1c4

    Cc: Manfred Spraul
    Cc: Alexander Nyberg
    Cc: Pekka Enberg
    Cc: Christoph Lameter
    Cc: Ravikiran Thirumalai
    Signed-off-by: Al Viro
    DESC
    slab-leaks3-locking-fix
    EDESC
    From: Andrew Morton

    Update for slab-remove-cachep-spinlock.patch

    Cc: Al Viro
    Cc: Manfred Spraul
    Cc: Alexander Nyberg
    Cc: Pekka Enberg
    Cc: Christoph Lameter
    Cc: Ravikiran Thirumalai
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Al Viro
     

25 Mar, 2006

1 commit


24 Mar, 2006

4 commits

  • As a foundation for reliable stack unwinding, this adds a config option
    (available to all architectures except IA64 and those where the module
    loader might have problems with the resulting relocations) to enable the
    generation of frame unwind information.

    Signed-off-by: Jan Beulich
    Cc: Miles Bader
    Cc: "Luck, Tony"
    Cc: Ralf Baechle
    Cc: Kyle McMartin
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: "David S. Miller"
    Cc: Paul Mundt ,
    Cc: Andi Kleen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Beulich
     
  • Restructure the bitmap_*_region() operations, to avoid code duplication.

    Also reduces binary text size by about 100 bytes (ia64 arch). The original
    Bottomley bitmap_*_region patch added about 1000 bytes of compiled kernel text
    (ia64). The Mundt multiword extension added another 600 bytes, and this
    restructuring patch gets back about 100 bytes.

    But the real motivation was the reduced amount of duplicated code.

    Tested by Paul Mundt using
    Signed-off-by: Paul Jackson
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Paul Jackson
     
  • Add support to the lib/bitmap.c bitmap_*_region() routines

    For bitmap regions larger than one word (nbits > BITS_PER_LONG). This removes
    a BUG_ON() in lib bitmap.

    I have an updated store queue API for SH that is currently using this with
    relative success, and at first glance, it seems like this could be useful for
    x86 (arch/i386/kernel/pci-dma.c) as well. Particularly for anything using
    dma_declare_coherent_memory() on large areas and that attempts to allocate
    large buffers from that space.

    Paul Jackson also did some cleanup to this patch.

    Signed-off-by: Paul Mundt
    Signed-off-by: Paul Jackson
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Paul Mundt
     
  • Paul Mundt says:

    This patch set implements a number of patches to clean up and restructure the
    bitmap region code, in addition to extending the interface to support
    multiword spanning allocations.

    The current implementation (before this patch set) is limited by only being
    able to allocate pages BITS_PER_LONG);

    As I seem to have been the first person to trigger this, the result ends up
    being the following patch set with the help of Paul Jackson.

    The final patch in the series eliminates quite a bit of code duplication, so
    the bitmap code size ends up being smaller than the current implementation as
    an added bonus.

    After these are applied, it should already be possible to do multiword
    allocations with dma_alloc_coherent() out of ranges established by
    dma_declare_coherent_memory() on x86 without having to change any of the code,
    and the SH store queue API will follow up on this as the other user that needs
    support for this.

    This patch:

    Some code cleanup on the lib/bitmap.c bitmap_*_region() routines:

    * spacing
    * variable names
    * comments

    Has no change to code function.

    Signed-off-by: Paul Mundt
    Signed-off-by: Paul Jackson
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Paul Jackson
     

23 Mar, 2006

2 commits

  • Semaphore to mutex conversion.

    The conversion was generated via scripts, and the result was validated
    automatically via a script as well.

    Signed-off-by: Arjan van de Ven
    Signed-off-by: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arjan van de Ven
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (78 commits)
    [PATCH] powerpc: Add FSL SEC node to documentation
    [PATCH] macintosh: tidy-up driver_register() return values
    [PATCH] powerpc: tidy-up of_register_driver()/driver_register() return values
    [PATCH] powerpc: via-pmu warning fix
    [PATCH] macintosh: cleanup the use of i2c headers
    [PATCH] powerpc: dont allow old RTC to be selected
    [PATCH] powerpc: make powerbook_sleep_grackle static
    [PATCH] powerpc: Fix warning in add_memory
    [PATCH] powerpc: update mailing list addresses
    [PATCH] powerpc: Remove calculation of io hole
    [PATCH] powerpc: iseries: Add bootargs to /chosen
    [PATCH] powerpc: iseries: Add /system-id, /model and /compatible
    [PATCH] powerpc: Add strne2a() to convert a string from EBCDIC to ASCII
    [PATCH] powerpc: iseries: Make more stuff static in platforms/iseries/mf.c
    [PATCH] powerpc: iseries: Remove pointless iSeries_(restart|power_off|halt)
    [PATCH] powerpc: iseries: mf related cleanups
    [PATCH] powerpc: Replace platform_is_lpar() with a firmware feature
    [PATCH] powerpc: trivial: Cleanup whitespace in cputable.h
    [PATCH] powerpc: Remove unused iommu_off logic from pSeries_init_early()
    [PATCH] powerpc: Unconfuse htab_bolt_mapping() callers
    ...

    Linus Torvalds
     

22 Mar, 2006

1 commit

  • Sam's tree includes a new check, which found that we're exporting strpbrk()
    multiple times.

    It seems that the convention is that this is exported from the arch files, so
    reove the lib/string.c export.

    Cc: Sam Ravnborg
    Cc: Yoshinori Sato
    Cc: David Howells
    Cc: Greg Ungerer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     

21 Mar, 2006

4 commits


24 Feb, 2006

1 commit


23 Feb, 2006

1 commit

  • This change reverts the 033b96fd30db52a710d97b06f87d16fc59fee0f1 commit
    from Kay Sievers that removed the mount/umount uevents from the kernel.
    Some older versions of HAL still depend on these events to detect when a
    new device has been mounted. These events are not correctly emitted,
    and are broken by design, and so, should not be relied upon by any
    future program. Instead, the /proc/mounts file should be polled to
    properly detect this kind of event.

    A feature-removal-schedule.txt entry has been added, noting when this
    interface will be removed from the kernel.

    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

19 Feb, 2006

1 commit


17 Feb, 2006

1 commit

  • If a tag is set for a node being deleted from a radix_tree, then that
    tag gets cleared from the parent of the node, even if it is set for some
    siblings of the node begin deleted.

    This patch changes the logic to include a test for any_tag_set similar
    to the logic a little futher down. Care is taken to ensure that
    'nr_cleared_tags' remains equals to the number of entries in the 'tags'
    array which are set to '0' (which means that this tag is not set in the
    tree below pathp->node, and should be cleared at pathp->node and
    possibly above.

    [ Nick says: "Linus FYI, I was able to modify the radix tree test
    harness to catch the bug and can no longer trigger it after the fix.
    Resulting code passes all other harness tests as well of course." ]

    Signed-off-by: Neil Brown
    Acked-by: Nick Piggin
    Signed-off-by: Linus Torvalds

    NeilBrown
     

10 Feb, 2006

1 commit


08 Feb, 2006

2 commits


07 Feb, 2006

3 commits


04 Feb, 2006

2 commits