23 Mar, 2011

40 commits

  • Change the printk() calls to have the KERN_INFO/KERN_ERROR stuff, and
    fixes other coding style errors. Not _all_ of them are gone, though.

    [akpm@linux-foundation.org: revert the bits I disagree with]
    Signed-off-by: Michael Rodriguez
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Rodriguez
     
  • Move setup_nr_cpu_ids(), smp_init() and some other SMP boot parameter
    setup functions from init/main.c to kenrel/smp.c, saves some #ifdef
    CONFIG_SMP.

    Signed-off-by: WANG Cong
    Cc: Rakib Mullick
    Cc: David Howells
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: Tejun Heo
    Cc: Arnd Bergmann
    Cc: Akinobu Mita
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Amerigo Wang
     
  • PTR_RET() can be used if you have an error-pointer and are only interested
    in the eventual error value, but not the pointer. Yields the usual 0 for
    no error, -ESOMETHING otherwise.

    Signed-off-by: Uwe Kleine-König
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Uwe Kleine-König
     
  • The oops=panic cmdline option is not x86 specific, move it to generic code.
    Update documentation.

    Signed-off-by: Olaf Hering
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: "H. Peter Anvin"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Olaf Hering
     
  • The device table is required to load modules based on modaliases.

    Signed-off-by: Axel Lin
    Cc: Masayuki Ohtak
    Cc: Greg Kroah-Hartman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Axel Lin
     
  • Don't allow everybody to change device settings.

    Signed-off-by: Vasiliy Kulikov
    Acked-by: Hartley Sweeten
    Cc: Matthieu Crapet
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vasiliy Kulikov
     
  • request_mem_region() will call kzalloc to allocate memory for struct
    resource. release_resource() unregisters the resource but does not free
    the allocated memory, thus use release_mem_region() instead to fix the
    memory leak.

    Signed-off-by: Axel Lin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Axel Lin
     
  • i2c_master_recv() returns negative errno, or else the number of bytes
    read. Thus i2c_master_recv(client, i2c_data, 2) returns 2 instead of 1 in
    success case.

    [akpm@linux-foundation.org: make `ret' signed]
    Signed-off-by: Axel Lin
    Cc: Kalhan Trisal
    Cc: Alan Cox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Axel Lin
     
  • Put the device into runtime suspend after resume()/probe() is handled by
    the PM core and the device core code. No need to manually add them in
    each single driver. And correct the runtime state in remove().

    Signed-off-by: Hong Liu
    Signed-off-by: Alan Cox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Hong Liu
     
  • This is a configurable gadget. can be configured by configfs interface.
    Any IP available at PCIE bus can be programmed to be used by host
    controller.It supoorts both INTX and MSI.

    By default, the gadget is configured for INTX and SYSRAM1 is mapped to
    BAR0 with size 0x1000

    Signed-off-by: Pratyush Anand
    Cc: Randy Dunlap
    Cc: Jesse Barnes
    Cc: Viresh Kumar
    Cc: Shiraz Hashim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Pratyush Anand
     
  • Free the memory that is used only at init

    Signed-off-by: Shubhrajyoti Datta
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Shubhrajyoti Datta
     
  • Signed-off-by: Shubhrajyoti Datta
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Shubhrajyoti Datta
     
  • Re-ordering struct block_inode to remove 8 bytes of padding on 64 bit
    builds, which also shrinks bdev_inode by 8 bytes (776 -> 768) allowing it
    to fit into one fewer cache lines.

    Signed-off-by: Richard Kennedy
    Cc: Al Viro
    Cc: Jens Axboe
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Richard Kennedy
     
  • Unify identical gcc3.x and gcc4.x macros.

    Signed-off-by: Borislav Petkov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Borislav Petkov
     
  • printk()s without a priority level default to KERN_WARNING. To reduce
    noise at KERN_WARNING, this patch set the priority level appriopriately
    for unleveled printks()s. This should be useful to folks that look at
    dmesg warnings closely.

    Signed-off-by: Mandeep Singh Baines
    Cc: Jens Axboe
    Cc: Al Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mandeep Singh Baines
     
  • All architectures can use the common dma_addr_t typedef now. We can
    remove the arch specific dma_addr_t.

    Signed-off-by: FUJITA Tomonori
    Acked-by: Arnd Bergmann
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: "H. Peter Anvin"
    Cc: Ivan Kokshaysky
    Cc: Richard Henderson
    Cc: Matt Turner
    Cc: "Luck, Tony"
    Cc: Ralf Baechle
    Cc: Benjamin Herrenschmidt
    Cc: Heiko Carstens
    Cc: Martin Schwidefsky
    Cc: Chris Metcalf
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    FUJITA Tomonori
     
  • Commit 6caa76b ("tty: now phase out the ioctl file pointer for good")
    removed the ioctl file pointer. User Mode Linux's line driver uses this
    ioctl and needs a signature update too.

    Signed-off-by: Richard Weinberger
    Cc: Alan Cox
    Cc: Greg KH
    Cc: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Richard Weinberger
     
  • One of our users reported that when a user-level program SIGSEGVs under
    UML kernel, the resulting core dump is not very usable.

    I have reproduced that with the latest kernel:

    make ARCH=um defconfig; make ARCH=um

    Run the resulting kernel, then "inside" run this program:

    #include

    void *fn(void *p)
    {
    abort();
    }

    int main()
    {
    pthread_t tid;
    pthread_create(&tid, 0, fn, 0);
    pthread_join(tid, 0);
    return 0;
    }

    Analyze the coredump with GDB. Here is what you'll see:

    sudo gdb -q -ex 'set solib-absolute-prefix ../root_fs' -ex 'file ../root_fs/var/tmp/mt-abort' -ex 'core ../root_fs/var/tmp/core.762'
    Reading symbols from /usr/local/google/root_fs/var/tmp/mt-abort...done.
    [New Thread 763]
    [New Thread 762]
    Core was generated by `./mt-abort'.
    Program terminated with signal 6, Aborted.
    #0 0x0000000040255250 in raise () from ../root_fs/lib64/libc.so.6
    (gdb) info thread
    2 Thread 762 0x0000000000000000 in ?? ()
    * 1 Thread 763 0x0000000040255250 in raise () from ../root_fs/lib64/libc.so.6

    Note that thread#2 looks funny.

    (gdb) thread 2
    [Switching to thread 2 (Thread 762)]#0 0x0000000000000000 in ?? ()
    (gdb) info reg
    rax 0x0 0
    rbx 0x0 0
    rcx 0x0 0
    rdx 0x0 0
    rsi 0x0 0
    rdi 0x0 0
    rbp 0x0 0x0
    rsp 0x0 0x0
    r8 0x0 0
    r9 0x0 0
    r10 0x0 0
    r11 0x0 0
    r12 0x0 0
    r13 0x0 0
    r14 0x0 0
    r15 0x0 0
    rip 0x0 0
    eflags 0x0 [ ]
    cs 0x0 0
    ss 0x0 0
    ds 0x0 0
    es 0x0 0
    fs 0x0 0
    gs 0x0 0

    Examining the core shows that NT_PRSTATUS notes for all threads other than
    the one that crashed are zeroed out.

    I believe this is happening because neither ELF_CORE_COPY_TASK_REGS nor
    task_pt_regs are defined under ARCH=um, and so elf_core_copy_task_regs()
    becomes a no-op.

    Attached patch fixes this for SUBARCH={x86_64,i386}.

    Signed-off-by: Paul Pluzhnikov
    Cc: Jeff Dike
    Acked-by: WANG Cong
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Paul Pluzhnikov
     
  • Clean up code and remove duplicate code. Next patch will use
    pagevec_lru_move_fn introduced here too.

    Signed-off-by: Shaohua Li
    Cc: KOSAKI Motohiro
    Cc: Hiroyuki Kamezawa
    Cc: Andi Kleen
    Reviewed-by: Minchan Kim
    Cc: Rik van Riel
    Cc: Mel Gorman
    Cc: Johannes Weiner
    Cc: Hugh Dickins
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Shaohua Li
     
  • Up to 2.6.22, you could use remap_file_pages(2) on a tmpfs file or a
    shared mapping of /dev/zero or a shared anonymous mapping. In 2.6.23 we
    disabled it by default, but set VM_CAN_NONLINEAR to enable it on safe
    mappings. We made sure to set it in shmem_mmap() for tmpfs files, but
    missed it in shmem_zero_setup() for the others. Fix that at last.

    Reported-by: Kenny Simpson
    Signed-off-by: Hugh Dickins
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Hugh Dickins
     
  • Currently memblock_reserve() or memblock_free() don't handle overlaps of
    any kind. There is some special casing for coalescing exactly adjacent
    regions but that's about it.

    This is annoying because typically memblock_reserve() is used to mark
    regions passed by the firmware as reserved and we all know how much we can
    trust our firmwares...

    Also, with the current code, if we do something it doesn't handle right
    such as trying to memblock_reserve() a large range spanning multiple
    existing smaller reserved regions for example, or doing overlapping
    reservations, it can silently corrupt the internal region array, causing
    odd errors much later on, such as allocations returning reserved regions
    etc...

    This patch rewrites the underlying functions that add or remove a region
    to the arrays. The new code is a lot more robust as it fully handles
    overlapping regions. It's also, imho, simpler than the previous
    implementation.

    In addition, while doing so, I found a bug where if we fail to double the
    array while adding a region, we would remove the last region of the array
    rather than the region we just allocated. This fixes it too.

    Signed-off-by: Benjamin Herrenschmidt
    Acked-by: Yinghai Lu
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Benjamin Herrenschmidt
     
  • Signed-off-by: Kirill A. Shutemov
    Cc: Mel Gorman
    Cc: Rik van Riel
    Cc: KAMEZAWA Hiroyuki
    Reviewed-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kirill A. Shutemov
     
  • KM_USER1 is never used for vwrite() path so the caller doesn't need to
    guarantee it is not used. Only the caller should guarantee is KM_USER0
    and it is commented already.

    Signed-off-by: Namhyung Kim
    Acked-by: KAMEZAWA Hiroyuki
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namhyung Kim
     
  • For range-cyclic writeback (e.g. kupdate), the writeback code sets a
    continuation point of the next writeback to mapping->writeback_index which
    is set the page after the last written page. This happens so that we
    evenly write the whole file even if pages in it get continuously
    redirtied.

    However, in some cases, sequential writer is writing in the middle of the
    page and it just redirties the last written page by continuing from that.
    For example with an application which uses a file as a big ring buffer we
    see:

    [1st writeback session]
    ...
    flush-8:0-2743 4571: block_bio_queue: 8,0 W 94898514 + 8
    flush-8:0-2743 4571: block_bio_queue: 8,0 W 94898522 + 8
    flush-8:0-2743 4571: block_bio_queue: 8,0 W 94898530 + 8
    flush-8:0-2743 4571: block_bio_queue: 8,0 W 94898538 + 8
    flush-8:0-2743 4571: block_bio_queue: 8,0 W 94898546 + 8
    kworker/0:1-11 4571: block_rq_issue: 8,0 W 0 () 94898514 + 40
    >> flush-8:0-2743 4571: block_bio_queue: 8,0 W 94898554 + 8
    >> flush-8:0-2743 4571: block_rq_issue: 8,0 W 0 () 94898554 + 8

    [2nd writeback session after 35sec]
    flush-8:0-2743 4606: block_bio_queue: 8,0 W 94898562 + 8
    flush-8:0-2743 4606: block_bio_queue: 8,0 W 94898570 + 8
    flush-8:0-2743 4606: block_bio_queue: 8,0 W 94898578 + 8
    ...
    kworker/0:1-11 4606: block_rq_issue: 8,0 W 0 () 94898562 + 640
    kworker/0:1-11 4606: block_rq_issue: 8,0 W 0 () 94899202 + 72
    ...
    flush-8:0-2743 4606: block_bio_queue: 8,0 W 94899962 + 8
    flush-8:0-2743 4606: block_bio_queue: 8,0 W 94899970 + 8
    flush-8:0-2743 4606: block_bio_queue: 8,0 W 94899978 + 8
    flush-8:0-2743 4606: block_bio_queue: 8,0 W 94899986 + 8
    flush-8:0-2743 4606: block_bio_queue: 8,0 W 94899994 + 8
    kworker/0:1-11 4606: block_rq_issue: 8,0 W 0 () 94899962 + 40
    >> flush-8:0-2743 4606: block_bio_queue: 8,0 W 94898554 + 8
    >> flush-8:0-2743 4606: block_rq_issue: 8,0 W 0 () 94898554 + 8

    So we seeked back to 94898554 after we wrote all the pages at the end of
    the file.

    This extra seek seems unnecessary. If we continue writeback from the last
    written page, we can avoid it and do not cause harm to other cases. The
    original intent of even writeout over the whole file is preserved and if
    the page does not get redirtied pagevec_lookup_tag() just skips it.

    As an exceptional case, when I/O error happens, set done_index to the next
    page as the comment in the code suggests.

    Tested-by: Wu Fengguang
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Jan Kara
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jun'ichi Nomura
     
  • scan_swap_map() is a large function (224 lines), with several loops and a
    complex control flow involving several gotos.

    Given all that, it is a bit silly that it is marked as inline. The
    compiler agrees with me: on a x86-64 compile, it did not inline the
    function.

    Remove the "inline" and let the compiler decide instead.

    Signed-off-by: Cesar Eduardo Barros
    Reviewed-by: Pekka Enberg
    Reviewed-by: KOSAKI Motohiro
    Reviewed-by: KAMEZAWA Hiroyuki
    Reviewed-by: Minchan Kim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Cesar Eduardo Barros
     
  • The block in sys_swapon which does the final adjustments to the
    swap_info_struct and to swap_list is the same as the block which
    re-inserts it again at sys_swapoff on failure of try_to_unuse(). Move
    this code to a separate function, and use it both in sys_swapon and
    sys_swapoff.

    Signed-off-by: Cesar Eduardo Barros
    Tested-by: Eric B Munson
    Acked-by: Eric B Munson
    Reviewed-by: Pekka Enberg
    Reviewed-by: KAMEZAWA Hiroyuki
    Cc: Hugh Dickins
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Cesar Eduardo Barros
     
  • The block in sys_swapon which does the final adjustments to the
    swap_info_struct and to swap_list is the same as the block which
    re-inserts it again at sys_swapoff on failure of try_to_unuse(), except
    for the order of the operations within the lock. Since the order should
    not matter, arbitrarily change sys_swapoff to match sys_swapon, in
    preparation to making both share the same code.

    Signed-off-by: Cesar Eduardo Barros
    Tested-by: Eric B Munson
    Acked-by: Eric B Munson
    Reviewed-by: Pekka Enberg
    Reviewed-by: KAMEZAWA Hiroyuki
    Cc: Hugh Dickins
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Cesar Eduardo Barros
     
  • The block in sys_swapon which does the final adjustments to the
    swap_info_struct and to swap_list is the same as the block which
    re-inserts it again at sys_swapoff on failure of try_to_unuse(). To be
    able to make both share the same code, move the printk() call in the
    middle of it to just after it.

    Signed-off-by: Cesar Eduardo Barros
    Tested-by: Eric B Munson
    Acked-by: Eric B Munson
    Reviewed-by: KAMEZAWA Hiroyuki
    Cc: Hugh Dickins
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Cesar Eduardo Barros
     
  • It still exists within setup_swap_map_and_extents(), but after it
    nr_good_pages == p->pages.

    Signed-off-by: Cesar Eduardo Barros
    Tested-by: Eric B Munson
    Acked-by: Eric B Munson
    Reviewed-by: Pekka Enberg
    Reviewed-by: KAMEZAWA Hiroyuki
    Cc: Hugh Dickins
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Cesar Eduardo Barros
     
  • Since there is no cleanup to do, there is no reason to jump to a label.
    Return directly instead.

    Signed-off-by: Cesar Eduardo Barros
    Tested-by: Eric B Munson
    Acked-by: Eric B Munson
    Reviewed-by: Pekka Enberg
    Reviewed-by: KAMEZAWA Hiroyuki
    Cc: Hugh Dickins
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Cesar Eduardo Barros
     
  • Move the code which parses the bad block list and the extents to a
    separate function. Only code movement, no functional changes.

    This change uses the fact that, after the success path, nr_good_pages ==
    p->pages.

    Signed-off-by: Cesar Eduardo Barros
    Tested-by: Eric B Munson
    Acked-by: Eric B Munson
    Reviewed-by: Pekka Enberg
    Reviewed-by: KAMEZAWA Hiroyuki
    Cc: Hugh Dickins
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Cesar Eduardo Barros
     
  • The call to swap_cgroup_swapon is in the middle of loading the swap map
    and extents. As it only does memory allocation and does not depend on
    the swapfile layout (map/extents), it can be called earlier (or later).

    Move it to just after the allocation of swap_map, since it is
    conceptually similar (allocates a map).

    Signed-off-by: Cesar Eduardo Barros
    Tested-by: Eric B Munson
    Acked-by: Eric B Munson
    Reviewed-by: Pekka Enberg
    Reviewed-by: KAMEZAWA Hiroyuki
    Cc: Hugh Dickins
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Cesar Eduardo Barros
     
  • Since there is no cleanup to do, there is no reason to jump to a label.
    Return directly instead.

    Signed-off-by: Cesar Eduardo Barros
    Tested-by: Eric B Munson
    Acked-by: Eric B Munson
    Reviewed-by: KAMEZAWA Hiroyuki
    Cc: Hugh Dickins
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Cesar Eduardo Barros
     
  • Move the code which parses and checks the swapfile header (except for
    the bad block list) to a separate function. Only code movement, no
    functional changes.

    Signed-off-by: Cesar Eduardo Barros
    Tested-by: Eric B Munson
    Acked-by: Eric B Munson
    Reviewed-by: KAMEZAWA Hiroyuki
    Cc: Hugh Dickins
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Cesar Eduardo Barros
     
  • There is no reason I can see to read inode->i_size long before it is
    needed. Move its read to just before it is needed, to reduce the
    variable lifetime.

    Signed-off-by: Cesar Eduardo Barros
    Tested-by: Eric B Munson
    Acked-by: Eric B Munson
    Reviewed-by: Jesper Juhl
    Reviewed-by: Pekka Enberg
    Reviewed-by: KAMEZAWA Hiroyuki
    Cc: Hugh Dickins
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Cesar Eduardo Barros
     
  • Since there is no cleanup to do, there is no reason to jump to a label.
    Return directly instead.

    Signed-off-by: Cesar Eduardo Barros
    Tested-by: Eric B Munson
    Acked-by: Eric B Munson
    Reviewed-by: KAMEZAWA Hiroyuki
    Cc: Hugh Dickins
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Cesar Eduardo Barros
     
  • Move the code which claims the bdev (S_ISBLK) or locks the inode
    (S_ISREG) to a separate function. Only code movement, no functional
    changes.

    Signed-off-by: Cesar Eduardo Barros
    Tested-by: Eric B Munson
    Acked-by: Eric B Munson
    Reviewed-by: KAMEZAWA Hiroyuki
    Cc: Hugh Dickins
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Cesar Eduardo Barros
     
  • sys_swapon currently has two error labels, bad_swap and bad_swap_2.
    bad_swap does the same as bad_swap_2 plus destroy_swap_extents() and
    swap_cgroup_swapoff(); both are noops in the places where bad_swap_2 is
    jumped to. With a single extra test for inode (matching the one in the
    S_ISREG case below), all the error paths in the function can go to
    bad_swap.

    Signed-off-by: Cesar Eduardo Barros
    Tested-by: Eric B Munson
    Acked-by: Eric B Munson
    Reviewed-by: KAMEZAWA Hiroyuki
    Cc: Hugh Dickins
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Cesar Eduardo Barros
     
  • The only way error is 0 in the cleanup blocks is when the function is
    returning successfully. In this case, the cleanup blocks were setting
    S_SWAPFILE in the S_ISREG case. But this is not a cleanup.

    Move the setting of S_SWAPFILE to just before the "goto out;" to make
    this more clear. At this point, we do not need to test for inode because
    it will never be NULL.

    Signed-off-by: Cesar Eduardo Barros
    Tested-by: Eric B Munson
    Acked-by: Eric B Munson
    Reviewed-by: KAMEZAWA Hiroyuki
    Cc: Hugh Dickins
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Cesar Eduardo Barros
     
  • The bdev variable is always equivalent to (S_ISBLK(inode->i_mode) ?
    p->bdev : NULL), as long as it being set is moved to a bit earlier. Use
    this fact to remove the bdev variable.

    Signed-off-by: Cesar Eduardo Barros
    Tested-by: Eric B Munson
    Acked-by: Eric B Munson
    Reviewed-by: KAMEZAWA Hiroyuki
    Cc: Hugh Dickins
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Cesar Eduardo Barros